NameError: name 'Stim' is not defined

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Mac
PsychoPy version (e.g. 1.84.x): v2022.2.5
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:
I am trying to make two blocks in one of my tasks, called PA, and randomize trials in each block. I am using loops for this.

What did you try to make it work?:
It worked perfectly fine before I added an outer loop on the first PA task in the file.
this is my condition file


I had audio files in the same folder as my .psyexp file, which are named as shown in the Stim column.
it is also set as ‘set evert repeat’, and all the condition files are added in Additional Resources. I don’t understand why the name error keeps happening. Please help.
skpam.psyexp (135.3 KB)

What specifically went wrong when you tried that?:
Include pasted full error message if possible. “That didn’t work” is not enough information.

I’m on my phone so I can’t look at your code. Do you ever try to alter the value of Stim set by the spreadsheet?

the value of Stim is exactly the same as the audio file names. Would it cause trouble like this?