Question about namespaces and import. How to avoid calling os.system

Pekka Niiranen pekka.niiranen at wlanmail.com
Fri Jul 22 16:01:12 EDT 2005


Thanks,

I will analyse these 4 options and select the most suitable
since there are other issues involved too, like
"the "main.py" reads contents of a file to a list that gets
passed to the "gen.py" with dictionary "env_params"".
I try to avoid parsing the contents of the file both
in "main.py" and in "gen.py"

-pekka-

 > Jeff Epler wrote:

> In main.py, execfile("gen.py")
> 
> or
> 
> In gen.py, have something like
>     from __main__ import env_params
> 
> or
> 
> In main.py, have something like
>     import __builtins__; __builtins__.env_params = env_params
> 
> or
> 
> call a function in the gen.py with env_params as a parameter
>     import gen
>     gen.do(env_params)
> 
> Jeff



More information about the Python-list mailing list