title: Composition - Reference to another class in Python
body: <p>In my example below in Python, object x 'has-an' object y.  I'd like to be able to invoke methods of x from y.<br>
  I'm able to achieve it using @staticmethod, however I'm discouraged to do that.  </p>
  
  <p>Is there any way(s) to reference the whole Object x from Object y?</p>
  
  <pre><code>class X(object):
      def __init__(self):
          self.count = 5
          self.y = Y() #instance of Y created.
  
      def add2(self):
          self.count += 2
  
  class Y(object):
      def modify(self):
          #from here, I wanna called add2 method of object(x)
  
  
  x = X()
  print x.count
  &gt;&gt;&gt; 5
  
  x.y.modify()
  print x.count
  &gt;&gt;&gt; # it will print 7 (x.count=7)
  </code></pre>
  
  <p>Thanks in advance.</p>