<div dir="ltr"><br><div>Hello </div><div><br></div><div>I have a thread like :</div><div>class Homing(QObject):<br>    segnale_homing = pyqtSignal(bool, bool, )<br>    <br>    def __init__(self, parent=None):<br>        super().__init__(parent)<br>        self.pause_homing = True<br>    <br>   <br>    def run(self):<br>        while self.pause_homing == True:<br>            print('sleep')<br>            time.sleep(0.3)<br>        while self.pause_homing == False:<br>            print('in the thread')<br>            variable_1 = self.x5.read_bool('M103')<br>            variable_2= self.x5.read_bool('M102')<br>            <br>            self.segnale_homing.emit(variable_1, variable_2,)</div><div><br></div><div>in the main widget I have in the init</div><div><br></div><div>self.read_homing = Homing()<br>self.read_homing.x5 = self.x5<br>self.read_homing_thread = QThread()<br>self.read_homing.moveToThread(self.read_homing_thread)<br>self.read_homing_thread.started.connect(self.read_homing.run)<br>self.read_homing.segnale_homing.connect(self.readed_homing)<br>self.read_homing_thread.start()</div><div><br></div><div><br></div><div>then I have a button :</div><div><br></div><div>@pyqtSlot()<br> def on_pushButton_43_clicked(self):</div><div>        self.read_homing.pause_homing = False<br>        self.x5.write_bool('M8', True)<br>        self.x5.write_bool('M325', True)</div><div><br></div><div>Then I have the function connected to the signal</div><div><br></div><div>def readed_homing(self,variable_1,variable_2)</div><div>       print(variable_,variable_2)</div><div>       self.read_homing.pause_homing = True</div>        msg = QMessageBox(QMessageBox.Icon.Warning, "variable_1"+ str(variable_1)+             "Variable_2 "+str(variable_2))<br>                msg.setStyleSheet("QMessageBox{ background-color: qlineargradient(spread:pad, x1:0.227, y1:0.3125, x2:1, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));}"<br>                        "QPushButton{background-color: rgba(0, 0, 0,0%);border: 1px solid; border-radius: 3px;border-color: black; color: black}"<br>                        "QLabel{color:white;}")<br>                msg.exec()<div><br></div><div>I expect that when I set again the variable self.read_homing.pause_homing = True the thread continues to run with the "print sleep" as he do at the first start, but in reality the thread never run after I set the variable pause_homing to True.</div><div><br></div><div>So at the beginning he cycles in the "sleep" than when I press the button he goes in the thread and give me back the variable value, but after I set again to True the self.read_homing.pause_homing = True  he stop running</div><div><br></div><div>What is wrong??</div><div><br></div><div><br></div><div><br></div></div>