Hi Monique,
I finally received your initial attachment (my University blocks zip files and it takes ages for them to be released).
Simply changing to "set every repeat" does indeed solve the problem and your task runs fine for me on PsychoPy 1.79.01 (although I had to change some paths and filenames: you should ideally use a relative rather than absolute path to refer to your conditions file).
> It's as if it's loading the definition for the variable too far down in the script, but asking for the definition early (for example, in the Stroop task, $word is the text that should be displayed from the conditions.xlsx file. In the Coder view, "word" is called on line 55, but the conditions.xlsx file, which should tell the program what value to give $word, is not imported until line 67).
This is exactly what happens when choosing "constant". You are telling Builder that the value to be used won't change, so it creates the component with that fixed attribute at the beginning of the experiment. If you select "set every repeat", it just creates a dummy value (e.g. for sounds, this is the note 'A') to initialise the sound object. It knows that eventually at some point a loop will be created and the variable will become available to use, which will replace the dummy value 'A'. For text stimuli, the dummy value is 'nonsense' I think.
> Okay, actually, I just fixed this error using the same technique, only further down in the script. PsychoPy is definitely loading the variables out of order if you use Builder view, creating a NameError for whatever the name of your condition is.
PsychoPy isn't "loading variables out of order". It is designed to work this way (optimising by initialising objects at the start of the script to avoid delays later on, using dummy values if needed). Rather, what you are doing is creating a contradiction: saying the value will be constant, but then feeding Builder a variable name. It gets confused, because as you have noticed, the variable isn't created until after the sound object is initialised.
Regards,
Michael