I have two functions defined in BLOCKY.
Using Python Code to define variable in one function:
spray_length = 1
Second function I try to use same variable but get an error that “spray_length” is undefined.
Do variables have to get defined inside a function when using Python Code?
Can they be made GLOBAL using Python Code?
Hi,
Could you show me the codes to help us understand the question?
1 Like

I want to move the “Python Code spray_length = 2” command to a different function.

When I move it I then I get the following error:

I want to define a VARIABLE in the “initialize operator settings” FUNCTION and have it passed to the “vacuum_spray_sequence” FUNCTION,
Hi

Try to modify the python code here
global spray_length
spray_length=2
1 Like
Here is how I was able to define a variable in one function and pass it to another without any errors.
spray_length = 1

and used in another funcrtion that calls the variable using Python Code:

by using time.sleep(self_vars[‘spray_length’])
Cool, that’s a better way.