Importing classes contained in a module
<p>I have the following files in my directory:</p>

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

<p>Within __init__.py:</p>

<pre><code>__all__ = ["bar"]
</code></pre>

<p>Within bar.py:</p>

<pre><code>class Bar:
    def __init__(self):
        None
    def hello(self):
        print("Hello World")
        return

def hi():
    print("Hi World")
</code></pre>

<p>Now if I have the following code within foo.py:</p>

<pre><code>from foolib import *

bar.hi()

foobar = Bar()
foobar.hello()
</code></pre>

<p>"Hi World" prints, but I get a NameError for Bar(). If I explicitly import the module:</p>

<pre><code>from foolib.bar import *
</code></pre>

<p>I get the expected output "Hello World".</p>

<p>Is there a way for me to import classes from the modules, without explicitly calling them? I feel like I am missing something in the __init__ file. Either that or I am flagrantly violating some Python best practice.</p>
