Possible Duplicate:
Retrieving python module path
Suppose I have code in 3 python files. x.py, y.py, z.py.
x calls y and y calls z. In the code in z.py, I want to know what directory x.py is in.
Is there a function that will tell me this?
EDIT
forget z.py. I just want y.py to print out the path of x.py.
EDIT
Note that the system has 30 different files all named x.py located in different directories.
If the code in
z.pyhas indirectly importedx.py, it will be insys.modules. So try: