title: Calling a decorated function correctly
body: <p>I'm trying to repeatedly call a decorated function from within another class, such that the decorator is executed everytime the function is called.</p>
  <p>The original question is below but does not explicitly relate to pyqt as pointed out correctly.</p>
  <p>I'm trying to use decorators within a pyqt thread. From how I understand decorators, the decoration should be executed every time the function is called. (Or at least that is what I want.) However, calling a decorated function from within a pyqt thread leads to execution of the decorator only once.</p>
  <p>This is my tested example:</p>
  <pre><code>import time, sys
  import numpy as np
  from PyQt5.QtCore import *
  from PyQt5.QtWidgets import *
  
  
  class Decor:
  
      def deco(self, *args, **kwargs):
          print(kwargs['txt'])
          print(&quot;In decorator&quot;)
  
          def inner(func):
              return func
  
          return inner
  
  
  dec = Decor()
  
  
  class Window(QWidget):
      def __init__(self, parent = None):
          QWidget.__init__(self, parent)
          self.thread = Worker()
          label = QLabel(self.tr(&quot;random number&quot;))
          self.thread.output[str].connect(label.setText)
          layout = QGridLayout()
          layout.addWidget(label, 0, 0)
          self.setLayout(layout)
          self.thread.start()
  
  
  class Worker(QThread):
      output = pyqtSignal(str)
  
      def run(self):
          # Note: This is never called directly. It is called by Qt once the
          # thread environment has been set up.
          while True:
              time.sleep(1)
              number = self.random()
              self.output.emit('random number {}'.format(number))
  
      @dec.deco(txt='kw_argument')
      def random(self):
          return np.random.rand(1)
  
  
  if __name__ == &quot;__main__&quot;:
      app = QApplication(sys.argv)
      window = Window()
      window.show()
      sys.exit(app.exec_())
  </code></pre>
  <p>I expected to get the prints of 'kw_argument' and 'in decorator' as often as <code>self.normal()</code>is called, but get it only once. What am I doing wrong?</p>