Calling a Python Script from within Pavlovia Experiment?


I’m working on an experiment which will query a python function every k-th trial with participant data and receive some information to then show the participant.

However, I’m having some trouble figuring out the best way to do this, as my server-side experience is limited.

Would it be recommended to set-up a server that can receive and send data to the jsPsych experiment to be retrieved from/shown to the participant (on Prolific). I’m hoping for the simplest path to get this functionality (send some data from jsPsych (a string) and retrieve some information as the output of a Python function (a string)), where the Python script would be in the local directory that I’m working out of for the experiment.

If helpful, I am using jsPsych 6.3 and working with Pavlovia as a backend.

Thanks for any tips with this!

I think you should try to write the Python function in JavaScript. What does it do?

Is there a reason why you are using jsPsych instead of PsychoPy/PsychoJS?