Nov-13-2022, 08:42 PM
(Nov-13-2022, 04:17 PM)deanhystad Wrote: I'll wager on the error being a NameError caused by moving an assignment from global to function scope. Your program used to look like this:
def func(): print(a) if __name__ == "__main__": a = 5 func()And you changed it to this:
def func(): print(a) def main(): a = 5 func() if __name__ == "__main__": main()Am I close?
Error:NameError: name 'a' is not defined
Actually yes, what ended up happening is my class variables became undefined, which threw a wrench in everything that worked previous to the swap. We ended up not needing to change anything in my script, but I was left with the question of why it didnt work.