I currently have a very basic websocket server impl:
import asyncio
import websockets
from websockets.server import serve
async def run():
async with serve(handler, "localhost", 8765):
print("Websocket server up")
await asyncio.Future()
I have another file where I import this function. I would like to run this non-blocking since I also have a discord bot running.
import asyncio
import config
import discord_bot
import websocket_server
if __name__ == "__main__":
asyncio.create_task(websocket_server.run())
discord_bot.bot.run(config.DISCORD_TOKEN)```
When running this though, I receive the error `RuntimeError: no running event loop`. How do I fix this?