import directory containing python src files as module
<p>I've a question on importing a python directory foo as a module. The structure is:  </p>

<blockquote>
  <p>-- <code>foo</code>    </p>
  
  <blockquote>
    <p>--<code>__init__.py</code><br>
    --- <code>file1.py</code><br>
    --- <code>file2.py</code></p>
  </blockquote>
</blockquote>

<p><code>__init__.py</code> contains the following line:<br>
<code>__all__ = ["file1", "file2"]</code></p>

<p>What I would want to do is to import foo and then access <code>file1</code> as <code>foo.file1</code> 
However, I can only access <code>file1</code> after doing:<br>
<code>from foo import *</code><br>
There's a way by which I can access file1 through <code>foo.file1</code>, it is:<br>
<code>from foo import *</code><br>
<code>import foo</code><br>
As you can see this is quite inefficient. Can someone point me to what is the right way to do what I am aiming to do.</p>

<p>Thanks</p>
