passing globals to imported module

Jeff Shannon jeff at ccvcorp.com
Mon Aug 16 22:09:49 CEST 2004


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




More information about the Python-list mailing list