title: How to import classes defined in __init__.py
body: <p>I am trying to organize some modules for my own use. I have something like this:</p>
  
  <pre><code>lib/
    __init__.py
    settings.py
    foo/
      __init__.py
      someobject.py
    bar/
      __init__.py
      somethingelse.py
  </code></pre>
  
  <p>In <code>lib/__init__.py</code>, I want to define some classes to be used if I import lib. However, I can't seem to figure it out without separating the classes into files, and import them in<code>__init__.py</code>. </p>
  
  <p>Rather than say:</p>
  
  <pre><code>    lib/
        __init__.py
        settings.py
        helperclass.py
        foo/
          __init__.py
          someobject.py
        bar/
          __init__.py
          somethingelse.py
  
  from lib.settings import Values
  from lib.helperclass import Helper
  </code></pre>
  
  <p>I want something like this:</p>
  
  <pre><code>    lib/
        __init__.py  #Helper defined in this file
        settings.py
        foo/
          __init__.py
          someobject.py
        bar/
          __init__.py
          somethingelse.py
  
  from lib.settings import Values
  from lib import Helper
  </code></pre>
  
  <p>Is it possible, or do I have to separate the class into another file?</p>
  
  <h2>EDIT</h2>
  
  <p>OK, if I import lib from another script, I can access the Helper class. How can I access the Helper class from settings.py?</p>
  
  <p>The example <a href="http://docs.python.org/tutorial/modules.html" rel="noreferrer">here</a> describes Intra-Package References. I quote "submodules often need to refer to each other". In my case, the lib.settings.py needs the Helper and lib.foo.someobject need access to Helper, so where should I define the Helper class?</p>