'A way to get task from function

Is there a way to get task object from function this task uses? For example, if I have:

async def f():
    task = ...
    print(task)

loop.create_task(f)
loop.run_forever()

Can I get the task from the function f?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source