How to import package modules as __main__ aliases inside __init__.py?
<p>I would like to import all modules inside a package as aliases in __main__ using __init__.py so they can be called simply from interactive mode. For example, here is a sample file tree:</p>

<pre><code>foobar/
    __init__.py
    foo.py
    bar.py
</code></pre>

<p>and from the python interpreter I want to be able to import the package and have access to all modules using defined aliases like this:</p>

<pre><code>&gt;&gt;&gt; import foobar
&gt;&gt;&gt; &lt;module 'foobar' from 'C:\...'&gt;
&gt;&gt;&gt; f.func()
&gt;&gt;&gt; b.func()
</code></pre>

<p>This will require __init__.py to contain something along the lines of:</p>

<pre><code># __init__.py

from . import foo as f
from . import bar as b

# these will not work
__main__.f = f
__main__.b = b
</code></pre>

<p>How can I make this work?</p>

<p><strong>EDIT</strong></p>

<p>I don't want to use <code>from foobar import *</code> because it will not allow me to use aliasing.</p>

<p>Typing <code>from foobar import foo as f</code> for every module, every time I start interactive mode is not efficient because there could be hundreds of modules.</p>
