title: Absolute vs. explicit relative import of Python module
body: <p>I'm wondering about the preferred way to import packages in a Python application. I have a package structure like this:</p>
  
  <pre><code>project.app1.models
  project.app1.views
  project.app2.models
  </code></pre>
  
  <p><code>project.app1.views</code> imports <code>project.app1.models</code> and <code>project.app2.models</code>. There are two ways to do this that come to mind.</p>
  
  <p>With absolute imports:</p>
  
  <pre><code>import A.A
  import A.B.B
  </code></pre>
  
  <p>or with explicit relative imports, as introduced in <a href="http://docs.python.org/whatsnew/2.5.html#pep-328-absolute-and-relative-imports" rel="noreferrer">Python 2.5 with PEP 328</a>:</p>
  
  <pre><code># explicit relative
  from .. import A
  from . import B
  </code></pre>
  
  <p>What is the most pythonic way to do this?</p>