title: Python Modules (modulename referenced before assignment)
body: <p>I have a <code>vm.py</code> in the same directory as the <code>main()</code> script (<code>getdata.py</code>). In <code>getdata.py</code>, I have</p>
  
  <pre><code>import vm
  ...
  x = vm.Something()
  </code></pre>
  
  <p>Then python complains </p>
  
  <pre><code>UnboundLocalError: local variable 'vm' referenced before assignment
  </code></pre>
  
  <p>Why is that? There was no error when importing. </p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I found that if I did </p>
  
  <pre><code>from vm import * 
  </code></pre>
  
  <p>Instead it worked. Also for another file/module I made, a simple <code>import</code> works. I uploaded the full code to GitHub Gist <a href="https://gist.github.com/2259298" rel="nofollow">https://gist.github.com/2259298</a></p>