Unable to import Python package universally
<p>Suppose I have the following directory structure:</p>

<pre><code>workspace/
  __init__.py
  ys_manage/
    __init__.py
    manage.py
  ys_utils/
    __init__.py
    project_dicts.py
</code></pre>

<p>Now, suppose I need access to <code>project_dicts.py</code> in <code>manage.py</code>.  Also, my <code>$PATH</code> includes <code>/home/rico/workspace/ys_manage</code>.</p>

<p>I need to be able to run <code>manage.py</code> from any directory on my machine and still be able to access <code>project_dicts.py</code>.</p>

<p>My <code>$PYTHONPATH</code> only has <code>/home/rico/workspace</code>.</p>

<p>If I include the following in <code>manage.py</code> I can run the file from <code>~/workspace/ys_manage</code> but not anywhere else.</p>

<pre><code>import sys
sys.path.append('..')
from ys_utils import project_dicts
</code></pre>

<p>It appears that the <code>'..'</code> gives a relative path to where the directory where the file is run, not where the file is located.  Is this correct?</p>

<p>I wanted to try and use <code>ys_manage/__init__.py</code> to import <code>project_dicts.py</code> so that it would be available in <code>manage.py</code> universally.  Is this a good idea?</p>

<p>I've never used <code>__init__.py</code> for anything other than a "package creator".  That is, I've never used it for initialization purposes.  Perhaps I'm doing it wrong.</p>

<p>Contents of <code>ys_manage/__init__.py</code>:</p>

<pre><code>import sys
sys.path.append('..')
from ys_utils import project_dicts
</code></pre>

<p>Should I include something in <code>manage.py</code> to look for this import?</p>

<p>When I try and run <code>manage.py</code> I get the following error:</p>

<pre><code>NameError: global name 'project_dicts' is not defined
</code></pre>

<p>As a secondary question, do I need to have <code>workspace/__init__.py</code>?  I'd really rather not have it because <code>ys_manage</code> and <code>ys_utils</code> (and about a dozen other packages) are all under revision control and used by several other developers...<code>workspace</code> is not.</p>
