I am new for both PyDev and Python, and Looking for help for following question. Suppose I have two files test1.py and test2.py, and their contents are as follows:
test1.py
from test2 import a
print a
test2.py
a=1
When I run the console, and use %run test1
to run the code test1.py, everything is fine, and I got output 1
. However, if I changed the value of a in the file test2.py (such as from 1 to 2), and then use %run test1
, I will still get 1
. I tried to use execfile('test2.py')
to reload test2.py, which however doesn't work.
Every thing will be ok, if I use the terminal to run code, i.e. python test1.py
, which will notice the change in test2.py whenever I run it. Only the console in eclipse is weird.
Note: The Operating System that I use is Windows 7.
Thanks for any help or attention in advance.