Local variable referenced before assignment in script node? I am doing a little project using animation nodes and I used a script in the node tree but it keep saying "Local variable referenced before assignment",I used global before the variable and it say "Syntax error".

My code is just as simple as :

if Bool == 1 :
    Always = 1


here is my node:

So what am I doing wrong?
The problem is that you don't assign a value to the 'Always' variable in all cases.

AN takes your code and makes a function from it that is executed by the Invoke Subprogram node. The generated code looks like so:



Line 16 throws the error here because you haven't used 'Always' before.
You can fix by changing your code to something like this:

if Bool == 1:
    Always = 1
else:
    Always = 0