Specific routine by experiment info

OS (e.g. Win10): WIN11
PsychoPy version (e.g. 1.84.x): 2022.2.3
What are you trying to achieve? I want a certin routine to appere by the answer in the ‘experiment info’ at the begining of the trail. i mean if the participant choose ‘male’ as gender and ‘X’ in ‘Y’ so he will see specific routine.


Hi @Eldad_Avital, there are multiple ways of doing this. If the routines that are presented based on gender are very different in structure you can have both / all routines that you need one after the other and simply immediately terminate the routines that don’t apply. For example by doing:

Begin routine

if expInfo["gender"] is not "male":
   continueRoutine = False

If the routines are the same in structure but (for example) simply display different text you can have one routine for all participants. In the beginning of the routine you could then specifiy (for example) which text should be shown:

Begin routine

if expInfo["gender"] == "male":
    welcome_text = "Hello man"
if expInfo["gender"] == "female":
    welcome_text = "Hello woman"

Then use $welcome_text in your text component and set to “set every repeat”.

I have 5 routines. I want that if the “gender” is “woman” then the participant will see routine 2 and not 1. and if the participen number is “X” then he will see routines 4 5 and not 3 5.
Is it possible to write code that under certain conditions in “expInfo” will send the participant to a specific routine?

As I described, you cannot “send” participants to routines you want to show. But you can skip routines you don’t want to show with the code I proposed.

When I try to use the code, this is the error that appears
"NameError: name ‘expInfo’ is not defined
################ Experiment ended with exit code 1 [pid:17856]

Have you added gender (in lower case to match the code) to your dialogue box?