Let's quote docs:
reload(module)
Reload a previously imported module. The argument must be a module object, so it must have been successfully imported before. This is
useful if you have edited the module source file using an external
editor and want to try out the new version without leaving the Python
interpreter. The return value is the module object (the same as the
module argument).
The argument must be a module object, so it must have been successfully imported before. When you do from inputs import *
you actually has no module object in your namespace. Only module members.
When reload(module) is executed:
- Python modules’ code is recompiled and the module-level code reexecuted, defining a new set of objects which are bound to names in
the module’s dictionary. The init function of extension modules is not
called a second time.
- As with all other objects in Python the old objects are only reclaimed after their reference counts drop to zero.
- The names in the module namespace are updated to point to any new or changed objects.
- Other references to the old objects (such as names external to the module) are not rebound to refer to the new objects and must be
updated in each namespace where they occur if that is desired.
Other references to the old objects (such as names external to the module) are not rebound to refer to the new objects and must be updated in each namespace where they occur if that is desired. You star-imported A, B and C are precisely other references.
To sum up, an example code would be:
import os # see below
# fake module before changes
with open('inputs.py', 'w') as f:
f.write("a, b, c = 1, 2, 3")
import inputs
# check if all members are correct
assert inputs.a == 1
assert inputs.b == 2
assert inputs.c == 3
os.unlink('inputs.pyc') # Remove previously compiled byte-code.
# I'm now sure if it's mandatory, anyway for some reason Python
# does not recompile inputs.py in my experiments.
# New fake file
with open('inputs.py', 'w') as f:
f.write("a, b, c = 4, 5, 6")
reload(inputs)
# check if members has changes
assert inputs.a == 4
assert inputs.b == 5
assert inputs.c == 6