Создавайте несколько потоков, и управляйте ими.
class thread(target: Callable, args: Tuple = (), kwargs: Dict = {}):
def start(self) -> None:
def stop(self) -> None:
is_running
def is_running(self) -> bool:
Пример использования:
def test(word, name): while True: print(f"Hello {word}, from {name}") time.sleep(1) my_thread = thread(test, args=("world", "Igor")) my_thread.start() while True: print("Main thread working too...") time.sleep(1) pass
Last updated 11 months ago
Was this helpful?