Python - No module named
<p>I have the following code with few modules:</p>

<pre><code>import Persistence.Image as img
import sys

def main():
    print(sys.path)
    original_image = img.Image.open_image()


if __name__ == "__main__":
    main()
</code></pre>

<p>(I've created my own Image module)</p>

<p>And so I'm getting the following error claiming that the Persistence module does not exist:</p>

<pre><code>Traceback (most recent call last):
  File "/home/ulises/PycharmProjects/IntelligentPuzzle/Puzzle.py", line 1, in &lt;module&gt;
    import Persistence.Image as img
ImportError: No module named Persistence.Image
</code></pre>

<p>I've been searching for this problem here but can't find anything that worked to solve this as the directory tree seems to be correct as you can see on this image:</p>

<p><a href="http://i.stack.imgur.com/EgAkA.png" rel="nofollow"><img src="http://i.stack.imgur.com/EgAkA.png" alt="enter image description here"></a></p>

<p>I'm using ubuntu if it's any use.</p>

<p>Thanks and regards!</p>

<p>I don't believe that you are importing with proper syntax.  You need to use <code>from Persistance import Image as img</code>.  For example:</p>

<pre><code>&gt;&gt;&gt; import cmath.sqrt as c_sqrt
Traceback (most recent call last):
  File "&lt;pyshell#0&gt;", line 1, in &lt;module&gt;
    import cmath.sqrt
ImportError: No module named 'cmath.sqrt'; 'cmath' is not a package
&gt;&gt;&gt; from cmath import sqrt as c_sqrt
&gt;&gt;&gt; c_sqrt(-1)
1j
</code></pre>

python python-2.7