def send_thread(self): if self.thread is None: self.thread = FilepathSearchThread(self.treeWidget()) self.thread.finished.connect(self.receive_thread) thread_ready = self.thread.wait(10000) if thread_ready: tree = self.treeWidget() self.pbar = QProgressBar(tree) self.pbar.setRange(0, 0) tree.setItemWidget(self, 1, self.pbar) self.thread.filepath = self.filepath self.thread.start()