UnboundLocalError: local variable 'bodypart' referenced before assignment

OS (e.g. Win11):
PsychoPy version (e.g. 3.10):
Standard Standalone? (y/n) y
What are you trying to achieve?:
I am trying to randomise two tables and then combine together. But when I read in the two tables, it always give me unbound error, e.g., UnboundLocalError: local variable ‘bodypart’ referenced before assignment.

I would appreciate it a lot if anyone can help.

Many thanks

PL

stim_table_001.xlsx (9.8 KB)
PL_TNT_Training.psyexp (132.8 KB)

bodypart is one of your spreadsheet variables.

but then you also set it in StudyTrial

You don’t even seem to be using it. Just use body_list[curr_item] as you do in the BodyPart sound component.

Thank you so much! I did not know how I can oversee it.