Connecting two scripts/experiments

Hi all,

I feel like this is a simple and stupid question and yet, I can’t figure out a good way to do this. I have an experiment that is very complicated and thus set up using psychopy’s coder. After the participants finish this task, I want them to move to another one. I would like the experiment to redirect to another psychopy script and import the participant number, and condition into the new script. Is this possible using coder?

I do not want to add everything to the same python script. The first task already takes way too long to load (it sources 210 images at random from a library of 13,000 images), and I don’t want to make that worse.

Thanks in advance!

Even complicated experiments are still typically best conducted in Builder! Otherwise you’ll get long code that’s more complex than the graphical view!! :wink:

We’re planning a feature for Builder where you can combine multiple experiments into a single mega-study, but if you’re going to do this from pure code then the options would be:

  1. modularise your code: break the experiment into functions (like runTrial(stimList, corrAns) so that the complex stuff is hidden in a separate file and then the script that runs the study will be simpler for you to read/manage
  2. write it the way you are and do an import myOtherStudy at the end where myOtherStudy is the name of your other script
  3. use subprocess to launch the 2nd study as a separate Python process

I’ve never actually tried the options 2 or 3, I should add, but I think they would work

Thanks for the idea!

I am using coder because I am not using an conditions list and I want dynamic randomization per participant in this study. My script randomly selects an image and then based on the image it selects plus some probabilities I hard code, the script pseudo-randomly selects a second image. I never was able to figure out how to do all of that in builder and now I am too far down the coder rabbit hole.