import asyncio import time import aioschedule from app import set_online aioschedule.every(60 * 2).to(60 * 5).seconds.do(set_online) loop = asyncio.get_event_loop() while True: loop.run_until_complete(aioschedule.run_pending()) time.sleep(.1)