reload module
from importlib import reload # Python 3.4+ import foo while True: # Do some things. if is_changed(foo): foo = reload(foo)
Source: stackoverflow.com
from importlib import reload # Python 3.4+ import foo while True: # Do some things. if is_changed(foo): foo = reload(foo)