title: How to debug Python import failure
body: <p>I have a directory structure:</p>
  
  <pre><code>network/__init__.py
  network/model.py
  network/transformer/__init__.py
  network/transformer/t_model.py
  </code></pre>
  
  <p>both <code>__init__.py</code> files have appropriate</p>
  
  <pre><code>__all__ = [
      "model",  # or "t_model" in the case of transformer
      "view",
      ]
  </code></pre>
  
  <p>In t_model.py, I have</p>
  
  <pre><code>from .. import model
  </code></pre>
  
  <p>but it says:</p>
  
  <pre><code>ImportError: cannot import name model
  </code></pre>
  
  <p>If I try</p>
  
  <pre><code>from ..model import Node
  </code></pre>
  
  <p>it says:</p>
  
  <pre><code>ImportError: cannot import name Node
  </code></pre>
  
  <p>These are very confusing errors.</p>
  
  <hr>
  
  <p>Edit:  Even an absolute import fails:</p>
  
  <pre><code>import network as N
  print(dir(N), N.__all__)
  import network.model as M
  
  ['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'transformer'] ['model', 'view']
  Traceback (most recent call last):..........
  AttributeError: 'module' object has no attribute 'model'
  </code></pre>
  
  <hr>
  
  <p>Edit: <strong>It was a circular import</strong>.</p>