My module has __init__.py and still Python can't import it
<p>I have a small python module </p>

<pre><code>+-- address_book
|   +-- models.py
|   +-- __init__.py 
    +-- test
    |   +-- test_models.py 
</code></pre>

<p>When I run <code>python address_book/test/test_models.py</code> I get this error </p>

<pre><code>Traceback (most recent call last):
  File "address_book/test/test_models.py", line 5, in &lt;module&gt;
    from address_book import models
ImportError: No module named 'address_book'
</code></pre>

<h1>test_models.py</h1>

<pre><code>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import unittest
from address_book import models
...
...
...
if __name__ == '__main__':
    unittest.main()
</code></pre>

<p>Your file structure should look like </p>

<pre><code>+-- address_book
|    +-- __init__.py
|    +-- models.py
     +-- test
     |    +-- test_models.py
     |    +-- __init__.py
</code></pre>

<p>For your code to work you also have to be in the directory above address_book.</p>

python