title: How to implement a QPushbutton to emit pyqt signal and call another class?
body: <p>I'm trying to learn the basic usage of emitting/receiving signals and I'm running into some trouble. </p>
  
  <p>I wanted to start with something basic so I created a MainWindow and put a QPushButton called "plot". </p>
  
  <p>When the button is pushed it takes the arguments (self, xdata, ydata) and runs the method initiatePlot from my class MainWindow(QMainWindow)</p>
  
  <pre><code>    self.plotbtn = QPushButton("Plot")
      self.plotbtn.clicked.connect(partial(self.initiatePlot, xdata, ydata))
  
      def initiatePlot(self,x,y):
          PlotSignal = pyqtSignal(list, list)
          self.PlotSignal.emit(x, y)
  </code></pre>
  
  <p>Afterwards I tried to connect it to my plotter class, but I just get "Process finished exit code 1" I believe the error to be coming from this particular line of code in my below class.</p>
  
  <pre><code>self.PlotSignal.connect(self.plotData)
  </code></pre>
  
  <p>CODE FOR PLOTTER CLASS</p>
  
  <pre><code>class createFIG(FigureCanvas):
    def __init__(self):
      #super().__init__(Figure(tight_layout=True))
      self.figure = plt.figure()
      self.axes = self.figure.add_subplot(111)
  
      self.name = ""
  
      # xdata = [1,2,3,4,5]
      # ydata = [12,4,56,78,9]
  
      plt.figure()
      self.axes.set_xlabel('x label')
  
      #self.plotData(xdata,ydata)
  
      self.PlotSignal.connect(self.plotData)
  
  
    def plotData(self, xdata,ydata):
      print("plotting")
      self.axes.plot(xdata, ydata)
      self.draw()
      plt.show()
  </code></pre>
  
  <p>Sorry the whitespace might be a little messed up.</p>
  
  <p>The current issue is how I go about receiving the signal I emit from my initiatePlot method.</p>
  
  <p>The end goals is to be able to click the plot button and create a new window with a new plot figure each time. </p>
  
  <p>If there is an easier way to link the button in my mainwindow to plotting class that would be helpful. </p>
  
  <p>Here is a link to my full code: <a href="https://github.com/Silvuurleaf/InteractiveGraphing/blob/master/LiveGraphing.py" rel="nofollow noreferrer">https://github.com/Silvuurleaf/InteractiveGraphing/blob/master/LiveGraphing.py</a></p>