I have a .py config file that sets up a set of global variables. Among them is a variable called nMin. kNeighbors is another global variable defined in the exact same way as nMin. All the other variables included in the block are local variables
for i in range(PopLength):
noveltyMetric[i] = np.average(behavior[i][0:kNeighbors])
if noveltyMetric[i] > nMin:
...
In the loop, the program references kNeighbors with no issue, but on the next line I get the error:
local variable 'nMin' referenced before assignment"
I'm running this in PTVS 2017 and when it stops & displays the bug (while paused on that line), I call nMin in the "Immediate Window" and it calls the value correctly with no error. When I call the statement noveltyMetric[i] > nMin
it returns a Boolean with no error. But for some reason it still fails to execute the line in the code and insists I'm referencing it before it's defined.