Python to JS | Pavlovia: "ReferenceError: [function] is not defined"

URL of experiment:

Description of the problem:
Help me out because I’m desperate. Got no clue in JS.
In psychpy it works well. In pavlovia → function is not defined. don’t know why.
Faulty line: PracticeMatrix = new GenExpMatrix(PracticeTestPairCycles);

The section that include the faulty code:

var PracticeMatrix;
var CurrIter;
var CountAccuracy;
var _key_resp_allKeys;
var PrecticeInitRtnComponents;
function PrecticeInitRtnRoutineBegin(snapshot) {
  return async function () {
    TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
    //------Prepare to start Routine 'PrecticeInitRtn'-------
    t = 0;
    PrecticeInitRtnClock.reset(); // clock
    frameN = -1;
    continueRoutine = true; // until we're told otherwise
    // update component parameters for each repeat
    console.log("*** Generating Practice Matrix, ExperimentGroup:", ExperimentGroup, "ExperimentGroupPics:", ExperimentGroupPics);
    PracticeMatrix = new GenExpMatrix(PracticeTestPairCycles);
    CurrIter = 0;
    CountAccuracy = 0;

Error message:
Unfortunately we encountered the following error:

  • ReferenceError: GenExpMatrix is not defined

Try to run the experiment again. If the error persists, contact the experiment designer.

Please help me out!!! This function is defined in JS and it is all working well in python, not sure what’s the issue with the conversion.
I have a deadline coming soon, starting to re-think if Psychopy is the right tool :confounded:

Did you define the function in Before Experiment or Begin?

Hi Wakecarter,

How do I do that in Pavlovia?
Again, it is all working in Psychopy, so I assume it is defined correctly in Pyhton.

Please could you show a screenshot of where/how GenExpMatrix is defined in Python and JS (presumably in a code component)?

I was able to resolve it.
Not sure why, but Pavlovia didnt run my latest JS. I did check the git (view code, on line) and it showed the latest. When I changed something in Psyhcopy and uploaded to PV, it seems as if the file was uploaded but when running the experiment it ran an old version.
I deleted the project in PV and created a new one. Now it is working, AGAIN got no clue why…

Ctrl-Shift-R to flush the cache or use a different browser or an incognito tab.

Thank you!