import class defined in same module file?
<p>I have a module file called <code>mymodule.py</code>, which contains the following code:</p>

<pre><code>class foo:
    def __init__(self):
        self.foo = 1

class bar:
    import foo
    def __init__(self):
        self.bar = foo().foo
</code></pre>

<p>The <code>__init__.py</code> file in the same directory has </p>

<pre><code>from mymodule import foo
</code></pre>

<p>From a script in the same directory, I have the following code:</p>

<pre><code>from mymodule import bar
</code></pre>

<p>When I try to run <code>bar()</code>, I get the error that <code>No module named foo</code>. How can I create an instance of <code>foo</code> in <code>bar</code> when they are defined within the same module file?</p>
