How can I find out if a function or method is a normal function or an async function? I would like my code to automatically support normal or async callbacks and need a way
If you don't want to introduce another import with inspect, iscoroutine is also available inside asyncio.
inspect
iscoroutine
asyncio
import asyncio def isAsync(someFunc): return asyncio.iscoroutinefunction(someFunc)