On 15 July 2014 15:25, Nitin Kumar <nitin.n...@gmail.com> wrote: > Hi All, > > Say there are 3 files. > > a.py and b.py uses *import c* (which is the third python file c.py) > > is there a way we can know inside c.py that whether its a or b who is doing > the importing?
You can use the inspect module to get this information, e.g., see http://stackoverflow.com/questions/2654113/python-how-to-get-the-callers-method-name-in-the-called-method IMHO it is not good design for a module to depend on who is calling it. If you need that, pass a parameter to __init__ Regards, Gora _______________________________________________ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers