Using condition file parameters in form component?

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

OS (e.g. Win10): Windows 11
PsychoPy version (e.g. 1.84.x): v2024.2.1post4
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:
I am making an experiment where music is played during a Flanker task, and after the Flanker task, the user has to answer a questionnaire. Since the experiment consists of 4 sound conditions, I have setup a loop (musicLoop) w/ a conditions file containing the 4 sound files. The questionnaire has 4 parts as well (user will answer one part per loop iteration), so I had tried putting the files into the conditions file as well. I had thought I would be able to put the variable ($questionnaire) as an item for the Form component, but instead I get a NameError (shown in screenshots below). Sorry if itā€™s a odd question, I am very new to PsychoPy - are there different ways to ensure that a different questionnaire file is used per loop iteration?

What did you try to make it work?:
Double checking variable names, renamed parameter in conditions file and attempted initiating variable manually at the start of the experiment, using code component to code form manually

current properties of form component
image

loop w/ conditions file:
image

What specifically went wrong when you tried that?:
Include pasted full error message if possible. ā€œThat didnā€™t workā€ is not enough information.
NameError: name ā€˜questionnaireā€™ is not defined
################ Experiment ended with exit code 1 [pid:26232] #################

The form component is set at Begin Experiment. You could try having one form component for each questionnaire and then use a start condition set by the spreadsheet to select which one to present.

1 Like

I see, I thought the form component is only set at the start of the routine. About the second point, I didnā€™t even think about that solution! Iā€™ll try that and report here if it works. Thanks.