Acessing objects from differents files
<p>Let's say i have two files like this:</p>

<p>TestClass.py</p>

<pre><code>class Test:
    variable = None

    def __init__(self, value):
        self.variable = value
</code></pre>

<p>__main__.py</p>

<pre><code>from TestClass import Test
TestObject = Test(123)
</code></pre>

<p>Doing the following works, but I don't like it much. Want to find a way to do this without passing the object as an argument.</p>

<p>access.py</p>

<pre><code>def testFunction(TestObject):
    print TestObject.variable
</code></pre>

<p>Any ideas?</p>

<p>Anyways, thanks everybody for reading :)</p>

<p>EDIT: Thanks for the answers so far. The names were just an example, and importing the same module in many different files would mean different objects in memory doing the same function. I wish to access the object from <strong>main</strong>.py in any other module without having different copies of it in the memory.</p>
