# How to exports functions in UXP?

**URL:** <https://forums.creativeclouddeveloper.com/t/how-to-exports-functions-in-uxp/8335>\
**Category:** InDesign\
**Tags:** bug, feature-request, uxp, javascript, api-feedback\
**Created:** [August 27, 2024, 1:03pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-exports-functions-in-uxp/8335 "2024-08-27T13:03:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Niraj](https://avatars.discourse-cdn.com/v4/letter/n/7ba0ec/32.png) [@Niraj](https://forums.creativeclouddeveloper.com/u/Niraj)\
**Post date:** [August 27, 2024, 1:03pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-exports-functions-in-uxp/8335/1 "2024-08-27T13:03:48Z")

</div>

Hi all, I am developing an InDesign UXP plugin and I want to export javascript functions from one file to another but I am getting error

```auto
> "uxp://uxp-internal/domjs_scripts.js:2 Uncaught ReferenceError: module is not defined
> at test.js:9:1"

```

. Can anyone please help?  
Here is my code:

HTML

```auto
<!DOCTYPE html>
<html>

<head>
  <script src="main.js"></script>
  <script src="test.js"></script>
</head>
<style>
  .wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    flex-direction: column;
    display: flex;
    padding: 12px;
  }
</style>

<body>
  <div class="wrapper">
    <p> Congratulations! You just created your first plugin.</p>
  </div>
</body>
</html>

```

main.js

```auto
const { entrypoints } = require("uxp");
const { app } = require("indesign");

entrypoints.setup({
  commands: {
    showAlert: () => showAlert()
  },
  panels: {
    showPanel: {
      show({node} = {}) {}
    }
  }
});

showAlert = () => {
  Test.display();
    const dialog = app.dialogs.add();
    const col = dialog.dialogColumns.add();
    const colText = col.staticTexts.add();
    colText.staticLabel = "Congratulations! You just executed your first command.";

    dialog.canCancel = false;
    dialog.show();
    dialog.destroy();
    return;
}

```

test.js

```auto
 var Test = {
    text : "hhhhh",

    display : function() {
        console.log(this.text);
    }
}

module.exports.Test = Test;

```
