How to get the function name from within a function?

I want to get the function name from within a function. On the server side I use:
import sys
and
sys._getframe().f_code.co_name
to get the functionname.
This doesn’t work on the client side.

I guess I need to insert some JS to get this done, but I’m not familiar with this approach. Who can help me out?

Just a thought: would an exception object contain the function name? If so, then you could raise a bogus exception, and get it from there.

Perhaps you could explain what you’re actually trying to achieve. This feels like an XY problem to me and it’s the sort of thing where there is normally a better solution.

Skulpt is an incomplete implementation of Python and most introspection features are missing. I don’t think you can see the current function name.

May I ask why you need the function name?
I’ve been using Python for a few years and the only case where I would like to see the name of the current function is during debugging. That’s why I created this FR.

Indeed, I want to use the function name in a debug print statement. I understand now that Skulpt doesn’t support this. The solution which Stefano uses still means that you have to put the function name in a string yourself.
Exceptions can’t be used either as this would stop the processing.
I guess we have to wait untill Skulpt can handle this.
Thanks for the input!

The feature I’m requesting is exactly to avoid this: I would like to do print(f'x={x}') and see the full call stack next to the printed string, with links to the editors.