You could use trackback.extract_stack() to get the current stack trace. If you inspect this from within the imported module you could probably figure out who is importing you.

Do you really want the module where the import was done (the place where the import statement is)? Or are you trying to find the file containing the imported module?

Kent

Isr Gish wrote:
Chad Crabtree wrote:
>Is there a way to know what the path of the file is that imported a >module? I've tried __file__ and playing with globals() but I can't
>seem >to crack this.
>


There most be a way because the Tracebacks give us this info.
You want to take a look at the 'inspect' module. I belive looking at the source 
of the traceback module may help alot.

All the best,
Isr

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Reply via email to