this is a visual representation of my directory :
here is the code snippet from test1.py
....
def foo():
f=read("./test1.dat","r")
....
here is the code of test2.py
import imp
TEST1 = imp.load_source('test1', '../test1.py')
def test2():
TEST1.foo()
running test2.py
cd subdir
python test2.py
got IOERROR: No Such file or directory : "./test1.dat"
my question is :
if I don't change the structure of directory, for example move test2.py to its parent directory, is it possible to make module test1 find the correct file when calling it in module test2?