passing globals to imported module

James Tauber jtauber at jtauber.com
Mon Aug 16 22:57:30 CEST 2004


Actually he liked that a lot.

I think it's elegant too, although my preference is still for him to
change his design.

But thanks!

On Mon, 16 Aug 2004 13:09:49 -0700, "Jeff Shannon" <jeff at ccvcorp.com>
said:
> James Tauber wrote:
> 
> >Had a question from a colleague that I embarrassingly couldn't answer.
> >
> >He has a script, foo.py with a global. He wants to import bar.py and
> >needs that global available in bar.py
> >
> >  
> >
> 
> #### global.py
> my_global = "Hello!"
> 
> 
> #### foo.py
> import global, bar
> 
> print global.my_global
> 
> 
> #### bar.py
> import global
> 
> print global.my_global
> 
> ;)
> 
> Jeff Shannon
> Technician/Programmer
> Credit International
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
-- 
  James Tauber               http://jtauber.com/
  journeyman of some    http://jtauber.com/blog/




More information about the Python-list mailing list