RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop

Solution
from worker import worker, async_worker

@async_worker
async def datastream_handler(q):
    ...

@worker
def dashboard_handler(q):
    ...
if __name__ == "__main__":
    q = Queue()
    asyncio.run(datastream_handler(q))
    dashboard_handler(q)
    socket.run(app, host="0.0.0.0", port=5000)