title: python circular import error
body: <p>There is following structure:</p>
  
  <pre><code>bin.py
  package/
    __init__.py
    a.py
    b.py
  </code></pre>
  
  <p>Content of bin.py:</p>
  
  <pre><code>#!/usr/bin/python
  import package
  </code></pre>
  
  <p>Content of __init__.py:</p>
  
  <pre><code>import a
  </code></pre>
  
  <p>Content of a.py:</p>
  
  <pre><code>print "a &gt;&gt; begin"
  print "a &gt;&gt; import b"
  import b
  print "a &lt;&lt; import b"
  
  def Print():
      print b.var
  
  print "a &lt;&lt; end"
  </code></pre>
  
  <p>Content of b.py:</p>
  
  <pre><code>print "  b &gt;&gt; begin"
  print "  b &gt;&gt; import a"
  import a
  print "  b &lt;&lt; import a"
  
  var = 3
  a.Print()
  
  print "  b &lt;&lt; end"
  </code></pre>
  
  <p>If I run python './package/a.py' - all is ok.</p>
  
  <pre><code>./package/a.py
  a &gt;&gt; begin
  a &gt;&gt; import b
    b &gt;&gt; begin
    b &gt;&gt; import a
  a &gt;&gt; begin
  a &gt;&gt; import b
  a &lt;&lt; import b
  a &lt;&lt; end
    b &lt;&lt; import a
  3
    b &lt;&lt; end
  a &lt;&lt; import b
  a &lt;&lt; end
  </code></pre>
  
  <p>If I run python './bin.py', I catch error.</p>
  
  <pre><code>./bin.py
  a &gt;&gt; begin
  a &gt;&gt; import b
    b &gt;&gt; begin
    b &gt;&gt; import a
    b &lt;&lt; import a
  Traceback (most recent call last):
    File "./bin.py", line 2, in &lt;module&gt;
      import package
    File "/home/fervid/Projects/AutoClassification-Python/package/__init__.py", line 1, in &lt;module&gt;
      import a
    File "/home/fervid/Projects/AutoClassification-Python/package/a.py", line 3, in &lt;module&gt;
      import b
    File "/home/fervid/Projects/AutoClassification-Python/package/b.py", line 7, in &lt;module&gt;
      a.Print()
  AttributeError: 'module' object has no attribute 'Print'
  </code></pre>
  
  <p>What is the difference?</p>