I tried to reference a global variable in a function where it was defined outside of the function. The variable was made global and was defined before the function was defined or called.
For example the script looks something like this:
global add
add = 0
def addit():
print(add)
add = add + 1
addit()
addit()
The error in the terminal is that the variable (add in this example) is referenced before its assignment. I have searched online for help but I have not been able to figure it out.