I have a problem in reloading modules that are imported and used in a different module. For clarity, let's consider the example where I have two modules:
First Module: operation.py
def f(x,y):
return x+y
Second Module: test_operation.py
import operation
x=3
y=4
z= operation.f(x,y)
print z
If I go to the interpreter and write:
import test_operation
I will get 4 printed (z=4). If I change the function f in the first module operation.py to be:
def f(x,y):
return x+y+1
and then I write in the interpreter reload(test_operation), I will still get 4 printed instead of 5. It seems then that it reloads the module test_operation.py, but it doesn't reload the module operation.py that is imported in test_operation.py.
How do I solve such problem ? and In general case how do I make sure that all imported modules in my code are re-imported (or reloaded) every time they are changed ?