As of version 2026.2.3 embedded Pavlovia Surveys can receive variables from PsychoPy experiments as well as send them back. Here is a survey demonstrating complex randomisation using this method.
In this demo I access the same single-block survey four times to show five pages.

Here is the JSON for the survey
{
"title": "Randomised Block Design",
"pages": [
{
"name": "page1",
"visibleIf": "{nBlocks} = 1",
"elements": [
{
"type": "text",
"name": "question1",
"title": "This will always be the first page",
"textUpdateMode": "onTyping"
}
]
},
{
"name": "page2",
"visibleIf": "{showBlock} = \"A\"",
"elements": [
{
"type": "text",
"name": "question2",
"title": "Block A",
"textUpdateMode": "onTyping"
}
]
},
{
"name": "page3",
"visibleIf": "{showBlock} = \"B\"",
"elements": [
{
"type": "text",
"name": "question3",
"title": "Block B",
"textUpdateMode": "onTyping"
}
]
},
{
"name": "page4",
"visibleIf": "{showBlock} = \"C\"",
"elements": [
{
"type": "text",
"name": "question4",
"title": "Block C",
"textUpdateMode": "onTyping"
}
]
},
{
"name": "page5",
"visibleIf": "{nBlocks} = 4",
"elements": [
{
"type": "text",
"name": "question5",
"title": "This will always be the last page",
"textUpdateMode": "onTyping"
}
]
}
],
"showPrevButton": false,
"showQuestionNumbers": "off",
"clearInvisibleValues": "none",
"completeText": "{Complete}"
}
Note that I have set the first and last blocks to be visible if nBlocks is 1 or 4 and the other three blocks are visible if Block is A, B or C.
I have set the complete text to a variable {Complete}, hidden question numbers and attempted to hide the Previous button.
In the PsychoPy experiment pre-survey has a code component:
Begin Experiment
expInfo["nBlocks"] = 0
expInfo["Complete"] = "Continue"
Begin Routine
expInfo["nBlocks"] += 1
expInfo["showBlock"] = Block
and plus_one has a code component with:
Begin Routine
expInfo["nBlocks"] += 1
expInfo["Complete"] = "Submit to finish"
The spreadsheet for the loop just has one variable, Block:
Notes
-
There is currently a bug in embedded surveys which means that the Previous button is shown and can’t be changed. Since each time the survey is started only one page is shown, the Previous button does nothing.
-
On my first attempt I tried adding the first and last pages to the loop so that in those cases two pages were shown in the survey. This worked fine for the first page, but when the survey with the last page was shown, the last page was displayed first and you had to press the previous button to view the final block. I would therefore recommend only having one page shown for each survey instance (apart from the first instance).
-
Pavlovia Surveys have a built-in function for multi-block designs. However, I would only recommend using this if you are importing a multi-block survey from Qualtrics.
-
The data for each instance of the survey appears on a separate row. So long as you are showing different pages of the survey on each iteration of your loop, you can untick “is trials” to reduce the number of rows.
