global vars across modules

John Nagle nagle at animats.com
Sun Apr 22 17:38:28 EDT 2012


On 4/22/2012 12:39 PM, mamboknave at gmail.com wrote:

>
> Question:
> How can I access to the global 'a' in file_2 without resorting to the whole name 'file_1.a' ?

     Actually, it's better to use the fully qualified name "file_1.a". 
Using "import *" brings in everything in the other module, which often
results in a name clash.

     Just do

import file_1

and, if desired

localnamefora = file_1.a



					John Nagle



More information about the Python-list mailing list