title: How python calls each other between two classes?
body: <p>There are 2 classes: <code>class A</code> and <code>class B</code>. In <code>class A</code>,I want to call a method in <code>class B</code>. And at the same time, in <code>class B</code>,I want to call a method in <code>class A</code>.
  Like:</p>
  
  <pre><code>class A(object):
      """docstring for A"""
      def __init__(self):
          self.str_A = 'this is class A'
      def printA(self):
          print self.str_A
      def callB(self):
          B.printB()
  
  class B(object):
      """docstring for B"""
      def __init__(self):
          self.str_B = 'This is class B'
      def printB(self):
          print self.str_B
      def callA(self):
          A.printA()
  </code></pre>
  
  <h2>How can I achieve this?</h2>
  
  <p>Well,I revise my expression.</p>
  
  <pre><code>class A(object):
      """docstring for A"""
      def __init__(self):
          self.str_A = 'this is class A'
      def printA(self):
          print self.str_A
      There is a function to call printB in class B names CB.
  class B(object):
      """docstring for B"""
      def __init__(self):
          self.str_B = 'This is class B'
      def printB(self):
          print self.str_B
      There is a function to call printA in class A names CA.
  
  aaa = A()
  bbb = B()
  aaa.CB() or bbb.CA()
  </code></pre>
  
  <h1>Of course the above sentences is wrong.How can I achieve this?How python calls each other between two classes?</h1>
  
  <p>Here are my two classes：
  <code>class Stock</code> is a class to receive stock data，and <code>RtnTick</code> in <code>class Stock</code> can auto update.<code>class TradeSystem</code>is a class to make a GUI and when click the button,the program can make a stock exchange.GUI must display data in real time,so when <code>RtnTick</code> update the data,I want to call <code>self.e1_str.set()</code> in <code>class TradeSystem</code>for displaying. And when I click the button,I'll call <code>TradeCommit</code> in <code>class Stock</code> to make a deal.And I have omitted lots of other codes.These two classes are large.And...do you have a idea to solve this question?I'm new in python.Thanks.</p>
  
  <pre><code>class Stock(LtsAPI):   
      def RtnTick(self,t):
          global Sto,Configs_Path,Sto,AskPri,BidPri,AskVol,BidVol
          contract = t.InstrumentID
          if(contract in Sto):
          #Here I want to call **self.e1_str.set()** in class TradeSystem.
      def TradeCommit(self):
          #This is a function to trading.      
  
  
  class TradeSystem(object):
      def __init__(self):
  
          self.root = Tk()
  
          self.e1_str = StringVar()
          self.e1 = Entry(self.root,textvariable = self.e1_str)
          self.e1.bind('&lt;KeyPress&gt;')  
          self.e1.grid(row = 1, column = 0)
  
          #**self.e1_str.set()** can set the content to display.
  
      def Trade(self):
          self.button = Button(self.root,command = *call **TradeCommit** in class Stock*)
          #command is the function to run when triggered.
  </code></pre>