I launch IPython from the main folder /project
. Now if I make changes in the file /project/tests/some_module.py
, the changes fail to be autoreloaded in IPython. Also, I get the following message after I save the changes and want to run some other script in the prompt:
[autoreload of some_module failed: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/IPython/extensions/autoreload.py", line 229, in check
superreload(m, reload, self.old_objects)
ImportError: No module named some_module]
It seems it detects changes were made inside folder /tests
but it cannot import it. Can someone help me with this?
Edit:
For better clarification: I launch IPython from the terminal in the main folder. In this folder, I have another folder tests
. Inside tests
I have two python files:
some_module.py:
def hello_world():
print "Hello World!!!"
use_some_module.py:
from some_module import hello_world
hello_world()
Once I launched IPython, further changes in some_module.py won't be loaded in IPython. For example, if I add a second print "Hello Earth!!!"
in the definition of hello_world()
, and run run tests/use_some_module.py
, I get the error message shown above, and will only get the "Hello World!!!"
print.
Edit2: I would like a solution where I don't need to either change the working directory, or adding any search paths manually. I want it to be loaded automatically with autoreload.