title: How to pass the reference from inside one object to the constructor of another
body: <p>Let's say I am inside an object (object1) and I want to pass its reference to another object (object2) I created inside it.</p>
  
  <p>Inside object1:</p>
  
  <pre><code># ...
  self.object2Reference = object2(self)
  # ...
  </code></pre>
  
  <p>Code of object2:</p>
  
  <pre><code>class object2:
      def __init__(self, object1Reference)
          self.object1Reference = object1Reference
  # ...
  </code></pre>
  
  <p>It fails with the following error:</p>
  
  <pre><code>self.object2 = object2() 
  TypeError: __init__() takes exactly 2 arguments (1 given)
  </code></pre>
  
  <p>I want to be able to access variables and methods of object1 from inside object2.</p>
  
  <p><strong>Edit:</strong> <code>self.object2Reference = object2(self)</code> happens inside a method that is started via new thread, so self was not what I expected at this time. I tried to make this example as small and simple as possible but forgot one imported aspect doing so. My bad. But the answer is good and complete anyways and also shows the use of inheritance.</p>