Open In App

Reloading modules in Python

Last Updated : 15 Jul, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The reload() is a previously imported module. If you’ve altered the module source file using an outside editor and want to test the updated version without leaving the Python interpreter, this is helpful. The module object is the return value.

Reloading modules in Python2.x

reload(module)

For above 2. x and <=Python3.3

import imp
imp.reload(module)

Reloading modules for >=Python3.4 and above

import importlib
importlib.reload(module)

How do I unload a Python module?

Unloading a Python module is not possible in Python yet.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads