title: Problems importing from python package (local vs on the python path)
body: <p>I am unable to get the following things to work simultaneously in Python2.7:</p>
  
  <ul>
  <li><p>import submodules from a local package</p></li>
  <li><p>import submodules from the package when it is on the PYTHONPATH</p></li>
  </ul>
  
  <p>I have set up the sample directory structure as in the <a href="https://docs.python.org/2/tutorial/modules.html#packages" rel="nofollow">python docs for packages</a></p>
  
  <pre><code> cd tmp
   mkdir sound
   mkdir sound/formats
   mkdir sound/effects
   mkdir sound/filters
   cd sound
   touch __init__.py
   cp !$ formats/
   cp __init__.py formats/
   cp __init__.py effects/
   cp __init__.py filters/
   echo "def echofilter(): return(1) " &gt; effects/echo.py
   cd ../..
  </code></pre>
  
  <p>So, I end up with:</p>
  
  <pre><code>$ ls tmp/sound
  effects/  filters/  formats/  __init__.py
  </code></pre>
  
  <p>If I make the package local, as it would be if it were acting as a git submodule, for instance, ie by <code>cd tmp</code>, the following is successful:</p>
  
  <pre><code>$ python
  Python 2.7.10 (default, Oct 14 2015, 16:09:02) 
  [GCC 5.2.1 20151010] on linux2
  &gt;&gt;&gt; from sound.effects import echo
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>Yet if I am located somewhere else (<code>cd ..</code>), and I put the package on my PYTHONPATH, I cannot import as in the docs:</p>
  
  <pre><code>[~/tmp]$ cd ..
  [~]$ python
  Python 2.7.10 (default, Oct 14 2015, 16:09:02) 
  [GCC 5.2.1 20151010] on linux2
  &gt;&gt;&gt; import sys
  &gt;&gt;&gt; sys.path.append('/home/meuser/tmp/sound')
  &gt;&gt;&gt; from sound.effects import echo
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ImportError: No module named sound.effects
  &gt;&gt;&gt; sys.path.append('/home/meuser/tmp/sound/effects')
  &gt;&gt;&gt; from sound.effects import echo
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ImportError: No module named sound.effects
  </code></pre>
  
  <p>So how am I supposed to arrange things?</p>