← Go Back
This is useful because Python ignores
See also our post on the import system in Python.
How to Reload an Imported Module
Using theimportlib
standard module:>>> import importlib
>>> import module # Import module for the first time.
>>> import module # Does nothing.
>>> importlib.reload(module) # Re-import module.
This is useful because Python ignores
import
ing a module that has already been imported. Therefore, if the content of the module changed during the execution of the program or if you want to re-execute the content of the module, you must use importlib.reload()
.See also our post on the import system in Python.
🐍 You might also find interesting: