The two participants perform an experiment at the same time

Yes, both subjects do two tasks at the same time, and on a computer whose screen is extended, each screen shows one of the tasks.
Two keyboards are connected to the computer, which is actually known as a single keyboard by Psychopy.
In the first trial, there is no problem to start at the same time, because the first subject must press ‘y’ and the second subject must press ‘n’, but during the task, when, for example, the first subject finishes its trial earlier, press the ‘y’ button before the second subject trial ends and waits for ‘n’ that the second subject presses the ‘n’ button after the end of his trial, while the ‘y’ button is not recorded for it, so the next trial of the first subject starts but does not start for the second subject!
Would you please explain how to wait for both key presses before moving forward?
Thanks,
Fazel

In that case @Becca 's earlier proposal should work.

You need the trial to wait for both keys to be pressed before moving on but record the relevant key press and, for example, replace the stimulus with a blank or text.

I mean something like this:


I created a variable called “flag_B” in the feedback2 routine of the second subject and created a keyboard component(feed2_resp) so that if the first subject presses the ‘y’ button when the feedback of the second subject is playing, it will be taken by the keyboard component and saved in the flag_B.

And I call the flag_B variable at the beginning of the trial(fixpnt) so that if the first subject has already pressed the ‘y’ key, it will be considered using the “or” command in the code.

But in this case, I do not know why when I run the task_B and press the ‘n’ button first, it completely leaves the task, while if I hit the ‘y’ button first, this does not happen! Also, this happens only in the first trial and in the next trials, if I press ‘n’ first, it will not go out of task!
I appreciate any comments.
Fazel

Hi Wakecarter,
thanks for your help.
Can you tell me what you mean by replacing the stimulus with a blank or text?
Also I think that I have done the Becca’s earlier proposal here ?!
Thanks,
Fazel