# Experiment stuck initialising import random

**URL:** <https://discourse.psychopy.org/t/experiment-stuck-initialising-import-random/19178>\
**Category:** Online experiments\
**Created:** [December 22, 2020, 8:52am UTC](https://discourse.psychopy.org/t/experiment-stuck-initialising-import-random/19178 "2020-12-22T08:52:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lea\_rahel\_delfmann](https://avatars.discourse-cdn.com/v4/letter/l/4af34b/32.png) [@lea\_rahel\_delfmann](https://discourse.psychopy.org/u/lea_rahel_delfmann)\
**Post date:** [December 22, 2020, 8:52am UTC](https://discourse.psychopy.org/t/experiment-stuck-initialising-import-random/19178/1 "2020-12-22T08:52:32Z")

</div>

URL of experiment: [https://pavlovia.org/LeaRahel/consolidatietrial](https://pavlovia.org/LeaRahel/consolidatietrial)

Description of the problem:  
We want to run a study (made with PsychoPy builder) online, via Pavlovia. However, the experiment is stuck initializing. I found out that the error occurs in line 101 of the javascript syntax, which is: import \* as random from ‘random’. I have read that one cannot import from numpy or pandas. As random is from numpy, I am wondering whether this is the problem, and whether it is just not possible to run the study online, or whether there is an option to fix that problem?  
I would be thankful for any tip!  
Best,  
Lea

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [December 22, 2020, 9:01am UTC](https://discourse.psychopy.org/t/experiment-stuck-initialising-import-random/19178/2 "2020-12-22T09:01:26Z")

</div>

Hi Lea,

Have a look at my crib sheet (see pinned post)

---

<div class="post-metadata">

**Author:** ![lea\_rahel\_delfmann](https://avatars.discourse-cdn.com/v4/letter/l/4af34b/32.png) [@lea\_rahel\_delfmann](https://discourse.psychopy.org/u/lea_rahel_delfmann)\
**Post date:** [December 22, 2020, 9:05am UTC](https://discourse.psychopy.org/t/experiment-stuck-initialising-import-random/19178/3 "2020-12-22T09:05:18Z")

</div>

Hi wakecarter,  
Thanks for your reply! I already had a look at the crib sheet, and I saw that (under don’ts) it says that I cannot use numpy and panda or import, and for do’s you recommend to **Remove all references to avoid the experiment crashing while “initialising the experiment”**. I’m afraid I do not really understand what you mean by that?

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [December 22, 2020, 9:11am UTC](https://discourse.psychopy.org/t/experiment-stuck-initialising-import-random/19178/4 "2020-12-22T09:11:23Z")

</div>

You don’t need to import random to use random functions in PsychoPy. Maybe search for the crib sheet for the word random.

---

<div class="post-metadata">

**Author:** ![lea\_rahel\_delfmann](https://avatars.discourse-cdn.com/v4/letter/l/4af34b/32.png) [@lea\_rahel\_delfmann](https://discourse.psychopy.org/u/lea_rahel_delfmann)\
**Post date:** [December 22, 2020, 9:17am UTC](https://discourse.psychopy.org/t/experiment-stuck-initialising-import-random/19178/5 "2020-12-22T09:17:29Z")

</div>

Thanks again! Yes, I did that too, so if I understand it correctly, I can just use Math.random() instead of random() whenever I use this function, without importing.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [December 22, 2020, 9:37am UTC](https://discourse.psychopy.org/t/experiment-stuck-initialising-import-random/19178/6 "2020-12-22T09:37:47Z")

</div>

I’m pretty sure you can just use random() if you’ve specified random=Math.random in code\_JS

---

<div class="post-metadata">

**Author:** ![lea\_rahel\_delfmann](https://avatars.discourse-cdn.com/v4/letter/l/4af34b/32.png) [@lea\_rahel\_delfmann](https://discourse.psychopy.org/u/lea_rahel_delfmann)\
**Post date:** [December 22, 2020, 9:50am UTC](https://discourse.psychopy.org/t/experiment-stuck-initialising-import-random/19178/7 "2020-12-22T09:50:26Z")

</div>

Okay, I will try further! Thanks for your help.
