HomeLanguagesReloading modules in Python

Reloading modules in Python

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.

RELATED ARTICLES

2 COMMENTS

Most Popular

Dominic
32662 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7035 POSTS0 COMMENTS
Nicole Veronica
12174 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12260 POSTS0 COMMENTS
Shaida Kate Naidoo
7161 POSTS0 COMMENTS
Ted Musemwa
7427 POSTS0 COMMENTS
Thapelo Manthata
7125 POSTS0 COMMENTS
Umr Jansen
7127 POSTS0 COMMENTS