How to pass parameter to a module?

Michael Peuser mpeuser at web.de
Thu Sep 18 15:26:51 EDT 2003


"M-a-S" <NO-MAIL at hotmail.com>

> I thought about the third module. It doesn't sound good.
> I hoped there're some tricks with __dict__, frames and
> other __...__ objects.
>

Well, there are some tricks ;-)


myVariable='great surprise'
import x
.......

"This is modul X"
import sys
print sys.modules['__main__'].myVariable


But generally the namespace of a module is ... the module.

Kindly
Michael P






More information about the Python-list mailing list