title: How to send signal from inside of imported function on pyqt5?
body: <p>I have one Worker Thread on my program that returns a number every second, forever, until the stop signal is emmited on the Main Window. I want it to emit a signal everytime it changes a value, so I can update the Main Window with the returned value. I tried simply emmiting a signal in the function itself, but doesn't work.</p>
  
  <p>Worker:</p>
  
  <pre><code>from test import save_data
  
  class Worker(QObject):
      finished = pyqtSignal()  # give worker class a finished signal
  
      def __init__(self, parent=None):
          QObject.__init__(self, parent=parent)
  
      def do_work(self):
          save_data.main()
          self.finished.emit()  # emit the finished signal when the loop is done
  
      def stop(self):
          save_data.run = False  # set the run condition to false on stop
  </code></pre>
  
  <p>test.py:</p>
  
  <pre><code>import time
  from Pyqt5.QtCore import pyqtSignal
  
  run = True
  value = pyqtSignal(int)
  
  def main():
      x = 1
      while run:
          print(x)
          x += 1
          time.sleep(1)
          #value.emit(x)
  </code></pre>