Predefined module aliases in Python?
<p>I'm developing a library of Python modules that is fairly deeply nested, e.g.:</p>

<pre><code>\MyTools
    __init__.py
    \HydroTools
        __init__.py
        \bin
        \Code
            __init__.py
            hydro.py
    \TerraTools 
        __init__.py
       \bin
       \Code
           __init__.py
           terra.py
</code></pre>

<p>Is there some way to define aliases for the modules ahead of time (maybe by modifying <strong>init</strong>.py?), so that instead of importing with...</p>

<pre><code>from MyTools.HydroTools.Code import hydro
from MyTools.TerraTools.Code import terra
</code></pre>

<p>...I could do something cleaner like</p>

<pre><code>from MyTools import hydro, terra
</code></pre>

<p>You want to push these nested packages on top of your module namespace.</p>

<p>In <code>MyTools/__init__.py</code> add:</p>

<pre><code>from .HydroTools.Code import hydro
from .TerraTools.Code import terra
</code></pre>

python