# How to call a .jsx file from a .psjs file?

**URL:** https://forums.creativeclouddeveloper.com/t/how-to-call-a-jsx-file-from-a-psjs-file/10209
**Category:** UXP Plugin API
**Tags:** uxp, javascript
**Created:** [March 9, 2025, 10:31am UTC](https://forums.creativeclouddeveloper.com/t/how-to-call-a-jsx-file-from-a-psjs-file/10209 "2025-03-09T10:31:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![amide](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@amide](https://forums.creativeclouddeveloper.com/u/amide)
#### Post date: [March 9, 2025, 10:31am UTC](https://forums.creativeclouddeveloper.com/t/how-to-call-a-jsx-file-from-a-psjs-file/10209/1 "2025-03-09T10:31:03Z")

</div>

How to use a .psjs file in Photoshop to call a .jsx file, for example, if the content of the .jsx file is: alert(“Hello”);

---

<div class="post-metadata">

### Author: ![haller](https://avatars.discourse-cdn.com/v4/letter/h/53a042/32.png) [@haller](https://forums.creativeclouddeveloper.com/u/haller)
#### Post date: [March 9, 2025, 12:10pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-call-a-jsx-file-from-a-psjs-file/10209/2 "2025-03-09T12:10:24Z")

</div>

From what I know it can’t be done But you could do it this way, In the psjs file you call an action, in the action you put the link to the .jsx file

---

<div class="post-metadata">

### Author: ![sttk3](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sttk3](https://forums.creativeclouddeveloper.com/u/sttk3)
#### Post date: [March 9, 2025, 1:44pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-call-a-jsx-file-from-a-psjs-file/10209/3 "2025-03-09T13:44:36Z")

</div>

It was possible to achieve in this way, but it does not have future potential, so I recommend to write everything in UXP.

```auto
// main.psjs

/**
  * @file Execute ExtendScript from UXP Script
  * https://forums.creativeclouddeveloper.com/t/how-to-call-a-jsx-file-from-a-psjs-file/
  * https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-call-a-jsx-file-from-a-psjs-file/td-p/15193966
  * @version 1.0.0
  * @author sttk3.com
*/

const { localFileSystem } = require('uxp').storage ;
const { app, core, action } = require('photoshop') ;

const jsxFile = await localFileSystem.getEntryWithUrl('/Users/username/Desktop/alert.jsx') ;
const token = await localFileSystem.createSessionToken(jsxFile) ;

try {
  await core.executeAsModal(async () =>
    {
      await action.batchPlay(
        [
          {
            _obj: 'AdobeScriptAutomation Scripts',
            javaScript: {
              _kind: 'local',
              _path: token
            },
          }
        ], 
        
        {}
      ) ;
    }, 
    
    {
      commandName: 'ExtendScript', 
      interactive: true, 
    }
  ) ;
} catch(e) {
  await app.showAlert(e) ;
}

```

```auto
// alert.jsx

alert("Hello") ;

```

---

<div class="post-metadata">

### Author: ![amide](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@amide](https://forums.creativeclouddeveloper.com/u/amide)
#### Post date: [March 9, 2025, 2:19pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-call-a-jsx-file-from-a-psjs-file/10209/5 "2025-03-09T14:19:49Z")

</div>

Thank you for your help, thank you
