Control a python thread from outside
问题 I have a program, which needs to continuously run in the background, but be able to receive instructions to change. I have this thread running, which sends data to an Arduino and receives data back: class receiveTemp (threading.Thread): def __init__(self, out): threading.Thread.__init__(self) self.out = out def run(self): self.alive = True try: while self.alive: rec = send("command") self.out.write(rec) except BaseException as Error: print(Error) pass Now I need to change the command I send