Import functions create problems for Pavlovia

Unfortunately importing python libraries like that in JS is just not possible. There are a restricted set of libraries available to PsychoJS, and custom import statements are simply calling on things that don’t exist.

Now, you may be able to use other tools that come with JavaScript to emulate the same behavior, without those import statements. JavaScript has a native Math library, and it has randomization. I’m not sure why you need numpy specifically, but check out this thread and see if it helps: Converting python to JS - NumPy and and random.normal function

1 Like