How to reload a python module or package ?

August 09, 2021    /    Viewed: 381    /    Comments: 0    /    Edit


If you develop your own python module it can be useful to reload it each time you make some change. Examples of how to reload a python module:

Reload a module for Python = 3.4 or >

import importlib

importlib.reload(module)

Reload a module for Python >= 3.0 and < 3.4

import imp

imp.reload(module)

Reload a module for Python = 2

reload(module)

References


Card image cap
profile-image
Daidalos

Hi, I am Ben.

I have developed this web site from scratch with Django to share with everyone my notes. If you have any ideas or suggestions to improve the site, let me know ! (you can contact me using the form in the welcome page). Thanks!