Yes, this is done by not declaring your variables using const or var. PsychoPy will find any variables used, and declare them with global scope. If you do this yourself, it limits the variable scope to one part of the experiment e.g., the experimentInit function. So to fix, remove any manual use of const or var e.g.,
// number of study items, etc
numItems = 60;
numCates = 4;
numReps = numItems / 2;
numPairTypes = (numCates * (numCates - 1)) / 2; // permutation