Python global variable is not working as expected
<p>I'm just starting out with Python and experimenting with different solutions. I was working with global variables and I ran into something but don't know why it's doing what it's doing.</p>

<p>To start, I have two modules: test1 and test2. test1 is as follows:</p>

<pre><code>import test2
num = 0
def start():
    global num
    num = num + 5
    print 'Starting:'
    print num
    test2.add()
    print 'Step 1:'
    print num
    test2.add()
    print 'Step 2:'
    print num
</code></pre>

<p>And test2 is this:</p>

<pre><code>import test1
def add():
    test1.num = test1.num + 20
</code></pre>

<p>When I run test1.start() the output is:</p>

<blockquote>
  <p>Starting:<br>
  5<br>
  Step 1:<br>
  25<br>
  Step 2:<br>
  45</p>
</blockquote>

<p>Why doesn't test2 need the global declaration to modify the variable in test1? Line 5 in test1 requires it  at line 4, but if I remove both it still works (0, 20,40). I'm just trying to figure out why it's not working as I expected it to.</p>

<p>Thanks.</p>
