I have a lot of async code and I have the question.
May I have a singleton event loop in the whole project or I should use get_event_loop() in every function, method, class? Are there some problems to declare it one time and use it from any place in the project?
For example, I have 3 files app.py, views.py, internal.py
app.py
app = FastAPI()
loop = get_event_loop()
views.py
from app import app, loop
@app.get('/')
async def main(request):
loop.create_task(<any coroutine>)
return {'status': 'ok'}
internal.py
from app import loop
async def any_buisiness_logic():
loop.create_task(<any coroutine>)
return "task created"
Or I should get_event_loop() in every file?