title: Python module and __all__
body: <p>I trying to understand how to manage module with <code>__all</code>. For example, I have following structured code:</p>
  
  <pre><code>main.py
  |=&gt; /database
      |=&gt; __init__.py
      |=&gt; engine (with variables engine, session, etc.)
  </code></pre>
  
  <p>now I want to be able to import <code>session</code> and <code>engine</code> instances directly from <code>database</code> module like:</p>
  
  <pre><code>from database import session
  </code></pre>
  
  <p>I tried to add line <code>__all__ = ['session']</code> or <code>__all__ = ['engine.session']</code> to <code>__init__py</code> but when I trying to do import I've got an exception <code>AttributeError: 'modile' object has not attribute 'engine.session'</code>.</p>
  
  <p>Is there any way to achieve wanted behavior?</p>