I'm trying to create a program that checks the status of devices by sending them SNMP requests. The problem is that requests can take a long time and at this time the GUI just freezes. Here is my code:
class Widget(QWidget):
def __init__(self):
# Buttons and other stuff...
self.globalTimer = QTimer()
self.globalTimer.setInterval(1000)
self.globalTimer.timeout.connect(self.check_devices)
self.globalTimer.start()
def check_devices(self):
# Just sending requests...
How can I call this function in a separate thread? I tried to move the timer to a separate thread, but it didn't help.