I am looking for a way to get the name of a Python function from inside the function.
I tried by the inspect module, callin the stack() function …
import inspect def f1(): s = inspect.stack() f1()
… but I get a “__main__” error.
… And obviously, the error message shows me all those function names.
But I’d like to get them without making the script crash.
How can I do that ?