# Can't import a js on to another js uing wix and velo

**URL:** <https://forum.wixstudio.com/t/cant-import-a-js-on-to-another-js-uing-wix-and-velo/56582>\
**Category:** Ask the community\
**Tags:** code\
**Created:** [February 20, 2024, 11:14pm UTC](https://forum.wixstudio.com/t/cant-import-a-js-on-to-another-js-uing-wix-and-velo/56582 "2024-02-20T23:14:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mind\_Community](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mind_community/32/88556_2.png) [@Mind\_Community](https://forum.wixstudio.com/u/Mind_Community)\
**Post date:** [February 20, 2024, 11:14pm UTC](https://forum.wixstudio.com/t/cant-import-a-js-on-to-another-js-uing-wix-and-velo/56582/1 "2024-02-20T23:14:46Z")

</div>

I have been trying to import some global variables from a mainScript to a script dedicated to a page. I have been trying to import it and it detects it but it says that the variables I’m trying to use don’t exist in that script

I have two scripts

masterPage.js:

```javascript
export var preguntas = ["pregunta 1", "pregunta 2", "pregunta 3"];
export var randomNumber = 0;
export var respuestas = [];

```

the scripts of the page I’m working on

```javascript
import * as masterScript from "file:///public/masterPage.js";

$w.onReady(function () {
    $w("#Section1ListItem1Title1").text = masterScript.respuestas[0];
});

```

The error says:

> Property ‘respuestas’ does not exist on type ‘typeof import(“file:///public/masterPage”)’.

---

<div class="post-metadata">

**Author:** ![anthony](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/anthony/32/79536_2.png) [@anthony](https://forum.wixstudio.com/u/anthony)\
**Post date:** [February 21, 2024, 9:05pm UTC](https://forum.wixstudio.com/t/cant-import-a-js-on-to-another-js-uing-wix-and-velo/56582/2 "2024-02-21T21:05:49Z")

</div>

masterPage.js is for code that should run on all pages.

If you want to share code between pages then make a new public .js file and place your code there: [Where Do I Put My Code?](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/overview/where-do-i-put-my-code#i-want-some-code-to-run-on-multiple-but-not-all-pages)

Also this thread addresses this question:

> [@Import/reuse code from masterPage (and other page.js)](https://forum.wixstudio.com/t/import-reuse-code-from-masterpage-and-other-page-js/36275/2):
>
> Hi, In order to import functions/variables from a js file which are located on the public folder , you should use the following code: import {functionName} from 'public/jsFileName.js'; Make sure to export the functions / variables. Note that files that are created on the public folder are exposed, therefore it’s not recommended to put there keys and other information which you don’t want to be exposed. I recommend following the instructions of the article- Working with Javascript in Wix Cod…
