Python: how to share a variable between two modules
<p>I have viewed some other threads that address the problem but not quite get it. </p>

<p>Suppose I have a config file that contains a shared variable:</p>

<h3>Config.py</h3>

<pre><code>flag = False
</code></pre>

<h3>Test1.py</h3>

<pre><code>import config
while(1):
    config.flag = True
    print config.flag
</code></pre>

<h3>Test2.py</h3>

<pre><code>import config
while(1):
    config.flag = False
    print config.flag
</code></pre>

<p>If now I run <code>Test1.py</code> and <code>Test2.py</code>, can I see the switch between <code>'True'</code> <code>'False'</code> in the output? I don't care about synchronization at this point, as long as it can access the shared variable, then it's done.</p>

<p>Thanks.</p>
