Getting the name of the file that imported current module

Tobiah toby at rcsreg.com
Sun Jul 4 17:05:56 EDT 2010


foo.py:

import bar
bar.show_importer()

output:

'foo' or 'foo.py' or 'path/to/foo' etc.

Possible?

Thanks,

Tobiah



More information about the Python-list mailing list