def job():
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
flag==False
async def run_periodically(interval, periodic_function):
while True:
await asyncio.gather(asyncio.sleep(interval), periodic_function())
ib.run(run_periodically(0.1, check_messages))
```python