Reimport a module in python while interactive
I know it can be done, but I never remember how.
How can you re import a module in python? The scenario is as follows: I import a module interactively and tinker with it, but then I face an error. I fix the error in the .py file and then I want to re-import the fixed module without quitting python.
You can solve the python re import module error, by using the importlib and its function reload.
import importlib
importlib.reload(some_module)
If you are using python 3.2 or 3.3 you can use the following code:-
import imp
imp.reload(module)