Calling from a parent file in python
<p>I have a file called main.py and a file called classes.py</p>

<p>main.py contains the application and what's happening while class.py contains some classes.</p>

<p>main.py has the following code</p>

<p><strong>main.py</strong></p>

<pre><code>import classes

def addItem(text):
    print text

myClass = classes.ExampleClass()
</code></pre>

<p>And then we have classes.py</p>

<p><strong>classes.py</strong></p>

<pre><code>class ExampleClass (object):
    def __init__(self):
        addItem('bob')
</code></pre>

<p>Surprisingly enough that's not the actual code I am using because I've stripped out anything that'd get in the way of you seeing what I want to do. I want to be able to call a method that's defined in main.py from a class within classes.py. How do I do this?</p>

<p>Thanks in advance</p>
