knowing the caller of an import && exec question

bussiere bussiere bussiere at gmail.com
Tue Sep 7 16:31:34 CEST 2010


i've got toto.py :

import titi
def niwhom():
     pass

and titi.py :

def nipang():
      pass

how can i know in titi.py that's it's toto.py that is calling titi.py
and the path of toto ?

And

why :

bidule.py :
class bidetmusique:
         pass


truc.py :
X = __import__("bidule")

why exec("X.bidetmusique()") return none
and X.bidetmusique() return an object ?

How could i do to make this string "X.bidetmusique()" return an object ?

Regards and thanks
Bussiere
Eat the strawberry


Google Fan boy



More information about the Python-list mailing list