passing globals to imported module

James Tauber jtauber at
Mon Aug 16 21:45:17 CEST 2004

On Mon, 16 Aug 2004 21:24:16 +0200, "Mathias Waack" <M.Waack at>
> If you need the global _after_ the import you can just add in 
>   bar.my_global = my_global
> Another solution would be to use a better design;)

Well, changing the design was my first thought too :-)

I just wondered whether there was a way to set the globals for the
import module *before* top level code in the improted module is
executed. I'm unclear what the second arg to __import__ actually

  James Tauber     
  journeyman of some

More information about the Python-list mailing list