title: How to have "import X" importing all modules of package, but "from X import Y1" only importing/evaluating the module Y1?
body: <p>I have the following package/module structure:</p>
  <pre><code>X
  |-&gt; __init__.py
  |-&gt; y1.py
  |-&gt; y2.py
  </code></pre>
  <p>The functionality I want in my project is that when I do <code>import X</code> I get all the modules under the package <code>X</code> namespace: so, I can call <code>X.y1.functionA()</code> or <code>X.y2.functionB()</code>.</p>
  <p>That is easy enough if I write <code>__init__.py</code> as:</p>
  <pre><code>import X.y1
  import X.y2
  </code></pre>
  <p>Problem is, like this, if I do an <code>from X import y1</code> it still imports <code>y2</code> as well. But in this case I don't want to import (or even evaluated as someone pointed in the comments) <code>y2</code>, I really only want <code>y1</code> to get imported and evaluated.</p>
  <p>How do I go about this?</p>