This is a name conflict, you have a local variable with the same name as a variable declared in the global scope, change the name of one of its variables and no more conflict.
And as the local variable takes precedence, soon it will not be possible to obtain the value of fcfs
because it does not yet exist in the local scope of its function, however, if I change the name of its local variable there will be no conflict, see:
#variaveis globais
fcfs = False
#commands
def fcfscheck():
outroNome = not fcfs
And if you want to reference your global variable without changing the name, do what was suggested in the other answers global fcfs
, but try to make it easier for those who read your code.
https://answall.com/q/250362/5878
– Woss
This is a name conflict, you have a local variable with the same name as a variable declared in the global scope, change the name of your variable and you will no longer have conflict.
– gato