# Reference error issue

**URL:** <https://discourse.psychopy.org/t/reference-error-issue/20221>\
**Category:** Online experiments\
**Tags:** pavlovia\
**Created:** [February 5, 2021, 6:19am UTC](https://discourse.psychopy.org/t/reference-error-issue/20221 "2021-02-05T06:19:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hugh](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@Hugh](https://discourse.psychopy.org/u/Hugh)\
**Post date:** [February 5, 2021, 6:19am UTC](https://discourse.psychopy.org/t/reference-error-issue/20221/1 "2021-02-05T06:19:44Z")

</div>

URL of experiment: [Pavlovia](https://pavlovia.org/CogPsyDoc/210205)

Description of the problem: I am trying to run my experiment online, but there are issues with the javascript translation.  
When I try to run experiment in Pavlovia, I get reference error for variables “Test\_Condition”.  
I did look for the “Test\_Condition” in my .py code, but there’s no such a variable(& Prf\_Change…, also) and I didn’t add it(them).  
I would like to ask you to help solving this problem, and I would appreciate it if you could tell me why these problems occur. I really want to understand what is happening and why!

 ![무제 2](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/5/9/59b6858ab4aecf6c12134ecce72948381f793517.png)

- 

Whenever I upload to Pavlovia, I face the following window.  
How can I solve this problem, I’d appreciate any help on this too!

 ![무제](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/c/8/c86dd7b3112e86a84ba03b1b36e2ed5be52b52a9.jpeg)

---

<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:** [February 5, 2021, 7:52am UTC](https://discourse.psychopy.org/t/reference-error-issue/20221/2 "2021-02-05T07:52:04Z")

</div>

You have

```auto
Test_Condition = "";

Prf_Change = "";

```

in a Before Experiment code block. If you need them then I’d put them in Begin Experiment instead.

---

<div class="post-metadata">

**Author:** ![Hugh](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@Hugh](https://discourse.psychopy.org/u/Hugh)\
**Post date:** [February 5, 2021, 9:56am UTC](https://discourse.psychopy.org/t/reference-error-issue/20221/3 "2021-02-05T09:56:05Z")

</div>

@wakecarter Thank you for your reply,  
but I wonder where they came from.  
As I mentioned above, they are not written in my Psychopy code.

Btw, what should I do for removing the error window then?

Thanks in advanced.

---

<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:** [February 5, 2021, 10:26am UTC](https://discourse.psychopy.org/t/reference-error-issue/20221/4 "2021-02-05T10:26:55Z")

</div>

If you have a JS only code component the number the contents wouldn’t appear in the compiled Python file.

---

<div class="post-metadata">

**Author:** ![Hugh](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@Hugh](https://discourse.psychopy.org/u/Hugh)\
**Post date:** [February 5, 2021, 10:35am UTC](https://discourse.psychopy.org/t/reference-error-issue/20221/5 "2021-02-05T10:35:50Z")

</div>

I don’t need them for running my experiment.  
Before writing this I have checked every code in psychopy, no “Test\_Condition” there.  
But, let me check again.

I Really appreciate your help.

---

<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:** [February 5, 2021, 10:39am UTC](https://discourse.psychopy.org/t/reference-error-issue/20221/6 "2021-02-05T10:39:13Z")

</div>

```auto
  <Routine name="Simulation">
      <CodeComponent name="Simul_code">
        <Param name="Before Experiment" updates="constant" val="Simul_img = ''" valType="extendedCode"/>
        <Param name="Before JS Experiment" updates="constant" val="Test_Condition = &quot;&quot;;&amp;#10;" valType="extendedCode"/>

```

So – look in Simul\_code of Simulation routine

---

<div class="post-metadata">

**Author:** ![Hugh](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@Hugh](https://discourse.psychopy.org/u/Hugh)\
**Post date:** [February 5, 2021, 11:14am UTC](https://discourse.psychopy.org/t/reference-error-issue/20221/7 "2021-02-05T11:14:04Z")

</div>

I got it

 ![스크린샷 2021-02-05 오후 8.11.01](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/9/8/989a79439f83f9f845bc1fcbc23a1358bd9bc6f8.jpeg)  
Thank you.

But I have no idea what should I do next for running without reference error window?

Change the code “Test\_Condition” to “Simul\_img”?

---

<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:** [February 5, 2021, 11:58am UTC](https://discourse.psychopy.org/t/reference-error-issue/20221/8 "2021-02-05T11:58:06Z")

</div>

Why does this code component exist?

Why is is set to both?

---

<div class="post-metadata">

**Author:** ![Hugh](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@Hugh](https://discourse.psychopy.org/u/Hugh)\
**Post date:** [February 5, 2021, 12:38pm UTC](https://discourse.psychopy.org/t/reference-error-issue/20221/9 "2021-02-05T12:38:55Z")

</div>

First, I set “py” not “both”  
That pic is just show how translate py to js when I set ‘both’  
I did not use the 'Test\_Condition"

Still I wonder how can I fix the reference error for online test.
