Hi i’ve got another python problem. My left mouse button click causes a small script to run which assigns some variables. Later in my script I try to use these variables but I get an error saying they’re not defined. Global didn’t help, though I didn’t expect it to because neither of these are functions, just simple if statements. I wonder if the variables are only assigned while the lmb is pressed but I don’t really know what’s going on.
Here’s what my code looks like:
c = property # a boalean property starts as False
if leftmouseButtonClicked:
a = variable 1
b = variable 2
c = # boalean changed to True
if c:
if a = variable:
do stuff
I know the first bit is working, but in the second part my error says a is not defined. But the second part doesn’t run till after the first bit has, anyone wan’t to shed some light on it. It’s got me kinda stumped. I guess it’s because a is only defined on the run through of the script when the mouse is pressed and after this the variable is lost but I don’t know a good way to set it to stay apart from saving it which I’m no keen to do.