expInfo not defined exporting to Pavlovia (custom code component)

There are nine conditions in my experiment specified as such:

I have certain routines that I only want performed for some conditions. Therefore, I have included custom code components for those. Everything works fine locally, but I can’t get it to export to Pavlovia.

I specify in an early routine, in the Begin Experiment portion, the following: condNum = int(expInfo['condition'])

Even if I don’t create that variable, things work alright locally.

At the beginning of each routine (or frame, works either way), I specify:

if int(condNum) > 6:
    continueRoutine=False

The automatic JS is:
if ((Number.parseInt(condNum) > 6)) { continueRoutine = false; }

When I try to export my experiment to Pavlovia, I get the following error message:

Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 829, in findPathsInFile
File “”, line 1, in
NameError: name ‘expInfo’ is not defined

Any pointers?

The solution was the same as in this post:

I put a custom code component in my very first routine. I also used expInfo in my outermost loop, so it may be the same issue as in the link above.