title: Python, importing from same module: ImportError: cannot import name 'blah', __name__ == '__main__'
body: <p>Very easy issue to replicate. My current setup is:</p>
  
  <pre><code>package/
      __init__.py
      run.py
  </code></pre>
  
  <p>In my <code>__init.py__</code> I have:</p>
  
  <pre class="lang-py prettyprint-override"><code>blah = 4
  </code></pre>
  
  <p>And in my <code>run.py</code> I have:</p>
  
  <pre class="lang-py prettyprint-override"><code>from package import blah
  
  
  if __name__ == '__main__':
      print(blah)
  </code></pre>
  
  <p>I simply run it with <code>python run.py</code>. But I am getting <code>ImportError: cannot import name 'blah'</code>.</p>
  
  <p>How come I am not being able to import a variable from my package? I know how to workaround it, I am rather interested in knowing the reason for the error.</p>