Execute own urscript function in SingleStep

Hi,

is it possible to execute an own script function(def myFunc(): … end) when steping through the program?
My function is added to the program by an URCap InstallationNodeContribution.
If I run the program in contious/play mode everything is fine.
But if I select the script element, which calls my function an error occurs, which tells me, that the function is not known.
Is it possible to execute the function in single step mode?

Another workaround would be to call the function via the primary or secondary client interface.
But here I’m facing probably similiar issue: If I call URScript standard api function everything is fine. If I try to call my own function, nothing happens.

Has somebody an idea to get this working?
Thanks for yout help.

Hi Christian
In my understanding, if you can use primary or secondary interface in your case, you can enclose your own script function in the normal def block and then call your script function.

Hi SonglinCai,

I’ve already tried this. But my functions is not executed when sending it.
I’ve read another post, that states the indentation is very important, when sending multiple command lines to the interface. I will try this, since I sent it without indentation.

In the meantime I have found a way to execute my nodes with the single step button:
I duplicated my code, which was wrapped in a function in the preamble before. This works, but produced another issue.

Every node makes an rpc call. But generating multiple rpc obejct by calling the rpc_factory-method from ur script, seems to be consuming a lot of resources. So the command execution slows down extremly, when the program is running in loop mode. Single cycles are ok.