title: How to access a class variable from another class in python?
body: <p>I have the following code segment : </p>
  
  <pre><code>class A:
      def __init__(self):
          self.state = 'CHAT'
  
      def method1(self):
          self.state = 'SEND'
  
      def printer(self):
          print self.state
  
  
  class B(A):
      def method2(self):
          self.method1()
          print self.state
  
  ob_B = B()
  ob_A = A()
  ob_B.method2()
  ob_A.printer()
  </code></pre>
  
  <p>This gives me the output : </p>
  
  <pre><code>SEND
  CHAT
  </code></pre>
  
  <p>I want it to print :</p>
  
  <pre><code>SEND
  SEND
  </code></pre>
  
  <p>That is, when <code>B.method2</code> is modifying self.state by calling self.method1, I want it to modify the already existing value of <code>self.state = 'CHAT'</code> in A's instance. How can I do this?</p>