title: Sending Data from Child to Parent Window in PyQt5
body: <h1>What I can't do</h1>
  
  <p>I'm not able to send data back from a child to a parent window.</p>
  
  <h1>What I have</h1>
  
  <p>I've got a complex GUI with several windows sendíng data to child windows. Each window represents a unique Python-script in the same directory. There was no need to explicitely specify parents and childs, as the communication was always unidirectional (parent to child). However, now I need to send back data from childs to parents and can't figure out how to do this as each window (i.e. each class) has its own file.</p>
  
  <h1>Example</h1>
  
  <p>Here's a minimal example showing the base of what I want to accomplish.
  What it does: <code>win01</code> opens <code>win02</code> and <code>win02</code> triggers <code>func</code> in <code>win01</code>.</p>
  
  <pre><code># testfile01.py
  
  import sys
  from PyQt5.QtWidgets import *
  import testfile02 as t02
  
  class win01(QWidget):
  
      def __init__(self, parent=None):
          super(win01, self).__init__(parent)
  
          self.win02 = t02.win02()
          self.button = QPushButton("open win02", self)
          self.button.move(100, 100)
          self.button.clicked.connect(self.show_t02)
  
      def initUI(self):
          self.center
  
      def show_t02(self):
          self.win02.show()
  
      def func(self):
          print("yes!")
  
  if __name__ == '__main__':
      app = QApplication(sys.argv)
      ex = win01()
      ex.show()
      sys.exit(app.exec_())
  
  ##########################################################################
  
  # testfile02.py
  
  from PyQt5.QtWidgets import *
  import testfile01 as t01
  
  class win02(QWidget):
  
      def __init__(self, parent=None):
          super(win02, self).__init__(parent)
  
          self.win01 = t01.win01()
          self.button = QPushButton()
          self.button.clicked.connect(self.win01.func)
  
      def initUI(self):
          self.center()
  </code></pre>
  
  <h1>What I tried</h1>
  
  <p>Importing testfile01 in the second window always leads to the error:
  <code>RecursionError: maximum recursion depth exceeded.</code> </p>
  
  <p>Then, I tried the following approaches, but they didn't work either:</p>
  
  <ul>
  <li>Not importing testfile01 in <code>win02</code> and adjusting <code>parent=None</code> to different other objects</li>
  <li>Importing testfile01 within the <code>__init__</code> call of <code>win02</code></li>
  <li>Creating a signal in <code>win02</code> to trigger <code>func</code> in <code>win01</code></li>
  </ul>
  
  <h1>The Question</h1>
  
  <p>Is there a solution how to properly trigger <code>func</code> in <code>win01</code> from <code>win02</code>?</p>