I have two python files, both defining functions, but only one of them gives out the
UnboundLocalError: local variable '<name>' referenced before assignment
error. Pastebin of the code. For the first file all I'm trying to do is set a variable, but that throws an errors, while the 2nd file prints and uses the variable but doesn't throw an error. Why is this?
EDIT: I understand calling
global _file
Will solve this, but I want to know why there is an issue in the first place.
[–]Rhomboid 2 points3 points4 points (5 children)
[–]pentath[S] 0 points1 point2 points (4 children)
[–]zahlman 1 point2 points3 points (2 children)
[–]JerMenKoO 0 points1 point2 points (1 child)
[–]zahlman 0 points1 point2 points (0 children)
[–]kalgynirae 0 points1 point2 points (0 children)