Select block based on reaction

OS : macOS
PsychoPy version : 3.1.2
**What are you trying to achieve?:

I have two different loops( A and B ), and these two loops based on two different conditions: “high” and “low”. I want to choose one of these loop at the beginning of the task. e.g. a popup window show which condition you want to use: “high” or “low”. if you choose condition “high”, the loop A will work. if you choose condition “low”, the loop B will show up.

I am wondering is there any method to show a popup window, and then send the response variable “BlockCode” to the rest of experiment?

Thank you so much!

You don’t need a popup window. Just have a routine with a text stimulus that provides a question to the participant and a keyboard component that allows them just two possible responses, say 'l' or 'h'.

In the routines within each loop, insert a code component from the “custom” component panel. In the “begin routine” tab of each one, put something like this:

# for the high loop:
if your_keyboard_component.keys == 'l':
    continueRoutine = False # don't continue with this routine
    high_loop_name.finished = True # and stop the loop around it

and in the other one:

# for the low loop:
if your_keyboard_component.keys == 'h':
    continueRoutine = False # don't continue with this routine
    low_loop_name.finished = True # and stop the loop around it