title: importing modules in application, not package
body: <p>I am writing a Python (Python3) application (not a package) and have some doubts about the correct directory structure. At the moment I have this:</p>
  
  <pre><code>myapp/
      __init__.py
      launch.py
      core/
          __init__.py
          some_core_class.py
          other_core_class.py
      gui/
          __init__.py
          some_gui_class.py
          other_gui_class.py
  </code></pre>
  
  <p>I want the application to be started with <code>python launch.py</code> from any place in my directory structure - of course with prepending the correct path to <code>launch.py</code>, e.g. <code>python myapps/myapp/launch.py</code>.</p>
  
  <p>Inside my modules I use absolute imports, e.g. in <code>some_core_class.py</code> I write <code>from myapp.core.other_core_class import OtherCoreClass</code>. I use the same way in <code>launch.py</code>, e.g. <code>from myapp.core.some_core_class import SomeCoreClass</code>.</p>
  
  <p>But then launching it for example directly from dir <code>myapp</code> by writing <code>python launch.py</code> results in <code>ImportError: No module named 'myapp'</code>. I found I could make it work by changing my import in <code>launch.py</code> to <code>from core.some_core_class import SomeCoreClass</code> but this does not seem to me as a correct absolute import and is inconsistent with imports in other files.</p>
  
  <p>What is the best way to solve my issue? I would like to avoid adding <code>myapp</code> to <code>PATH</code> environment variable which would require manual edit by the user or an installer. How should I change my code or my imports to make the application launchable from anywhere? Is that even possible?</p>