title: Python module importing with sys.path and os.path issue
body: <p>I spent some time researching this and I just cannot work this out in my head. </p>
  
  <p>I run a program in its own directory home/program/core/main.py</p>
  
  <p>In main.py I try and import a module called my_module.py thats located in a different directory, say home/program/modules/my_module.py</p>
  
  <p>In main.py this is how I append to sys.path so the program can be run on anyone's machine (hopefully).</p>
  
  <pre><code>import os.path
  import sys
  
  # This should give the path to home/program
  sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__), '..'))
  # Which it does when checking with
  print os.path.join(os.path.abspath(os.path.dirname(__file__), '..')
  
  # So now sys.path knows the location of where modules directory is, it should work right?
  
  import modules.my_module # &lt;----RAISES ImportError WHY?
  </code></pre>
  
  <p>However if I simply do:</p>
  
  <pre><code>sys.path.append('home/program/modules')
  import my_module
  </code></pre>
  
  <p>It all works fine. But this is not ideal as it now depends on the fact that the program must exist under home/program.</p>