import direct.task class MyTask(direct.task.Task): def doTask(self): while not self.isDone(): print("Task is running...") self.step() task = MyTask() task.loop()
import asyncio async def myTask(): while True: print("Task is running...") await asyncio.sleep(1) loop = asyncio.get_event_loop() loop.create_task(myTask()) loop.run_forever()This code creates an asynchronous task named "myTask" that runs in a loop until it is cancelled. The task prints "Task is running..." every second. In conclusion, the Python direct.task.Task Task loop seems to be part of the DirectPython library, as well as being a feature of the asyncio library.