Putting two experiments in one project

Hello, I have two different experiments and I want to put them both on pavlovia one after another, so the participant wouldn’t need to go to the second experiment in a different project after the first one. Both experiments are big and would take a lot of time to edit one of them in the builder. I’ve tried compiling to python script and pasting second experiments’ script after the first ones’, but it either runs second experiment or nothing at all. I made sure to delete all experiment ending code in the end of first experiment script, so it wouldn’t close halfway, but I suppose there’s something more to that. Is there any way to merge these two experiments or make some kind of a redirection in the end of the first one, so the participant would stay in the same project? Any help would be appreciated, thank you!

The psyexp file is text so I think you’d do better to try and merge those files. Make sure you have no components or routines with the same name.

I made sure that no routines or components would have the same name. I opened first experiment code and put all component initializing code from the second experiment next to the first ones’. Then I deleted this code from the ending of the first experiment:


And appended all the routine-running code from the second one. But whenever I run the experiment, it ends at the end of the first one, the second one doesn’t start. I suppose this could be due to ExperimentHandler code, which is directed to the first experiment (don’t really know it’s purpose so just a guess):
And the second experiment has the ‘participant’ column name changed and ‘session’ column removed, if this could do any help. Any suggestions? Thank you!

Hi! Maybe try this applet to merge the experiment files. It takes care of everything automatically and worked fine for me so far: https://adjus.shinyapps.io/PsychoPyMerger/

Hello! Thank you for the suggestion! I’ve tried it, but when I open the merged experiment, it throws this error:
Traceback (most recent call last):
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py”, line 662, in fileOpen
self.updateAllViews() # if frozen effect will be visible on thaw
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py”, line 928, in updateAllViews
self.flowPanel.draw()
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py”, line 3269, in draw
thisTerm = self.loops[thisLoop][‘term’]
KeyError: ‘term’

It doesn’t throw any errors on the page however, do you know where the error could be? Thank you!

My only guess is, that this has something to do with incompatible experiment settings between the two experiments or variables that are used in both experiments. As far as I am aware these are the only things that can cause issues. On the other hand, I only used the applet with experiments build in Builder and the error looks pretty basic. So maybe there is more that can go wrong if you code the experiment in the Coder. How did you create the experiments?

I’ve changed the experiment settings in both experiments, there are no variables with the same name too. The experiments were created with builder, but there were some code components that could’ve raised the error maybe, don’t really know