who imported me?
Terry Reedy
tjreedy at udel.edu
Thu Jan 18 18:18:10 EST 2001
> (Hopefully) easy question: I'm writing a module that uses values in
> variables from the script that imported it.
>
> How can I tell which script is importing me?
I do not believe you can, unless the importing module were to stick a flag
somewhere accessible by the imported module. (Besides which, a module can
be imported multiple times by one or more other modules.)
> Is there some easier way to get the parent module's variable values?
The 'parent' module can stick values into an imported module, or probably,
include them as parameters in fu;nction calls.
Terry J. Reedy
More information about the Python-list
mailing list