title: In Python, is it possible to expose modules from subpackages at package level?
body: <p>I have the following conundrum. I'm trying to expose some modules from a subpackage of a package at the parent package level.</p>
  
  <p>The folder structure is the essentially like this:</p>
  
  <pre><code>script.py
  package/
      __init__.py
      module1.py
      subpackage/
          __init__.py
          submodule1.py
          submodule2.py
  </code></pre>
  
  <p>In the <code>script.py</code> file I currently have to write</p>
  
  <pre><code>from package.subpackage.submodule1 import foo
  </code></pre>
  
  <p>if I want to import something from the <code>submodule1.py</code> file, but I would like to be able to expose the files <code>submodule1.py</code> and <code>submodule2.py</code> at package level, so that all my imports can look like</p>
  
  <pre><code>from package.module1 import bar
  from package.submodule1 import foo
  from package.submodule2 import goo
  </code></pre>
  
  <p>Note that I don't want to expose <code>bar</code>, <code>foo</code> and <code>goo</code> at <code>package</code> level, i.e. <strong>not</strong></p>
  
  <pre><code>from package import bar
  from package import foo
  </code></pre>
  
  <p>because the separation between modules is still important in my case.</p>
  
  <p>Is this even possible? Is there a trick in the <code>__init__.py</code> file to do so?</p>
  
  <p>Thanks!</p>