Universal Robots Forum

Call a function within a function in URScript

Hi there,

I am trying to write a UR Script. I have defined a couple of functions.
My questions is how can i call functions within functions?

For example:

def reorder_int_to_bool_array(bool_array):
rearrange_bool_array = [ bool_array[24] ]
return rearrange_bool_array

def read_input_int(x):
register_input = reorder_int_to_bool_array(integer_to_binary_list(read_input_integer_register(x)))
return register_input

Thank you in advance!

Hi @ndriqim.hoxha,

your proposed script should work as intended.
I let in run in the Simulator and it behaved as expected.

Did you encounter a specific issue in combination with calling script functions?