Get importer module from imported module

dody suria wijaya dodysw at gmail.com
Mon Feb 7 05:48:03 EST 2005


I found this problem when trying to split a module into two.
Here's an example:

==============
#Module a (a.py):
from b import *
class Main: pass
==============

==============
#Module b (b.py)
def How():
    Main_instance = module_a.Main()
    return Main_instance
==============

> import a
> a.How()


the problem would show at How() function. I have been unable
to get variable pointing to module a from inside module b.
In short, I need to have a variable pointing to the module
whose importing me.


-- 
  dody s wijaya <dodysw at gmail.com>, YM: dody, [36932B53]




More information about the Python-list mailing list