exec code in "globaldict"
Terry Reedy
tjreedy at udel.edu
Thu Nov 4 19:39:41 EST 2004
"Gerald Senarclens de Grancy" <santa at sbox.tugraz.at> wrote in message
news:Nizid.55896$z77.3059 at news.chello.at...
> Hi!
> I kept searching my online and offline python ressources to figure out
> how to execute some code in the global dictionary.
Perhaps you are thinking of builtins. If so, leave it alone.
> Basically I'm reading a options file that defines some variables. I want
> to access those variables throughout my whole project, so I need them in
> the global dictionary.
Each module has its own global dict. For what you want, define a module
globals.py or options.py or config.py or whatever, have that module read
the options, and then import that module into all other modules.
Terry J. Reedy
More information about the Python-list
mailing list