title: mod_wsgi: import python modules with the same name
body: <p>This is a follow-up question to <a href="https://stackoverflow.com/questions/6630394/import-python-modules-with-the-same-name">import python modules with the same name</a>, but as the two are somewhat unrelated, it's probably better to ask a new question:</p>
  
  <p>I have several python projects and they all have a conf package:</p>
  
  <pre><code>/some_folder/project_1/
    conf/
      __init__.py
      some_source_file.py
  
  /another_folder/project_2/
    conf/
      __init__.py
      another_source_file.py
  </code></pre>
  
  <p>For each project, I have created a .pth file in the site-packages folder with this contents:</p>
  
  <pre><code>.../site-packages/project_1.pth:
  import sys; sys.path.append('/some_folder/project_1/')
  
  .../site-packages/project_2.pth:
  import sys; sys.path.append('/another_folder/project_2/')
  </code></pre>
  
  <p>Now, accessing the conf module works for /some_folder/project_1/:</p>
  
  <pre><code>import conf.some_source_file
  </code></pre>
  
  <p>but not for /another_folder/project_2/:</p>
  
  <pre><code>import conf.another_source_file
  AttributeError: 'module' object has no attribute 'another_source_file'
  </code></pre>
  
  <p>which is probably due to python only searching the first conf path underneath any folders in sys.path.</p>
  
  <p>I have therefore turned project_1 and project_2 into python packages and added a symlink in either, so I can access both conf packages in a fully qualified fashion:</p>
  
  <pre><code>/some_folder/project_1/
    __init__.py
    project_1 &lt;-- symlink to .
    conf/
      __init__.py
      some_source_file.py
  
  /another_folder/project_2/
    __init__.py
    project_2 &lt;-- symlink to .
    conf/
      __init__.py
      another_source_file.py
  </code></pre>
  
  <p>In an ordinary python script, I can now import modules from both conf packages:</p>
  
  <pre><code>import project_1.conf.some_source_file
  import project_2.conf.another_source_file
  </code></pre>
  
  <p><strong>However</strong>, when I try to do the same within an WSGI application using the mod_wsgi Apache module, the import fails for the second project. Specifically, the wsgi 'start file' (i.e. the one with a wsgi suffix referenced in the WSGIScriptAlias statement in the Apache config file for my virtual server) successfully imports a module in /another_folder/project_2/ which in turn imports project_2/conf/another_source_file.py.</p>
  
  <p>The second import fails, despite the fact that /another_folder/project_2/ is in sys.path. The WSGI application is running in daemon mode.</p>
  
  <p>How can I get this sorted ?</p>