title: Correctly return variable from python module
body: <p>I'm sure this is absurdly simple but I have been unable to get it working. </p>
  
  <p>I want to return the value of <code>x</code> from within my function <code>test</code> in the module 'user_module' to my 'main_program'</p>
  
  <p><strong>file: user_module</strong></p>
  
  <pre><code>def test ():
      x =5
      return x
  </code></pre>
  
  <p><strong>file: main_program</strong></p>
  
  <pre><code>import user_module
  user_module.test()
  print x
  </code></pre>
  
  <p>However the above code does not work :( I get the following error</p>
  
  <pre><code>NameError: name 'x' is not defined
  </code></pre>