reload imported module python code example
Example 1: python refresh import
from importlib import reload
import foo
while True:
# Do some things.
if is_changed(foo):
foo = reload(foo)
Example 2: python reload import
import my_module # initial import of my_module
from importlib import reload
my_module = reload(my_module) # reload of my_module