Python Importing Mechanism
- First, it checks if the module is already cached in the sys.module dictionary.
- And only if it’s not there, it actually imports the module.
Which means that, if you already imported the module (or imported a different module that references this one) and you try to import it again, Python will ignore this request.
So, if you can’t reimport a module, you can restart Python or you can reload the module.
Reload module as follow:
import importlib
importlib.reload(my_module)