title: Python imports with leading dot no longer recognised going from py3 to py2 in django
body: <p>I've copied a project I worked on with python3 to a workstation that only has python2. Python is now complaining about one of my imports.</p>
  
  <p>The line is </p>
  
  <pre><code>from .mage.models import ButtLoadOfClasses
  </code></pre>
  
  <p>The error however says</p>
  
  <pre><code>ImportError: No module named mage.models
  </code></pre>
  
  <p>My project tree looks like this:</p>
  
  <pre><code>nwod-db-master/
      characters
           mage
               models.py
           admin.py
  </code></pre>
  
  <p>The import is in the admin.py.</p>
  
  <p>So I presume it's chopping off the dot, and then treating it as an absolute import - mage.models is not on my path so it barfs.</p>
  
  <p>I've searched for this and most relevant thing I can find is here <a href="https://softwareengineering.stackexchange.com/q/159503/42685">What's wrong with relative imports in Python?</a> which is more about coding style, and doesn't lead me to a solution - except that it leads me to believe that relative imports are a python3 only thing. I also saw this: <a href="https://stackoverflow.com/q/4521416/1075247">Python/Django is importing the wrong module (relative when it should be absolute)</a> but that is for template tags. I've yet to resort to the hackery in the accepted answer, as I'm hoping things have moved on in the last ~4 years.</p>
  
  <p>How do I force python to import this as an absolute reference to the package?</p>