# Unable to Create a New Path Using Photoshop API in UXP: batchPlay Returns Error

**URL:** <https://forums.creativeclouddeveloper.com/t/unable-to-create-a-new-path-using-photoshop-api-in-uxp-batchplay-returns-error/6850>\
**Category:** UXP Plugin API\
**Tags:** bug, uxp, javascript\
**Created:** [September 20, 2023, 12:05pm UTC](https://forums.creativeclouddeveloper.com/t/unable-to-create-a-new-path-using-photoshop-api-in-uxp-batchplay-returns-error/6850 "2023-09-20T12:05:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![KumaCC](https://avatars.discourse-cdn.com/v4/letter/k/58f4c7/32.png) [@KumaCC](https://forums.creativeclouddeveloper.com/u/KumaCC)\
**Post date:** [September 20, 2023, 12:05pm UTC](https://forums.creativeclouddeveloper.com/t/unable-to-create-a-new-path-using-photoshop-api-in-uxp-batchplay-returns-error/6850/1 "2023-09-20T12:05:54Z")

</div>

Hello,

I’m attempting to create a new path in Adobe Photoshop using the UXP API, and I’ve encountered some issues. Below is the code snippet I’ve been trying to use:

```auto
const batchPlay = require("photoshop").action.batchPlay;

async function createPath() {
  await batchPlay(
    [
      {
        "_obj": "make",
        "_target": [
          {
            "_ref": "path",
            "_name": "My Path"
          }
        ],
        "using": {
          "_obj": "path",
          "knotVector": [
            {
              "_obj": "pathPointInfo",
              "anchor": [100.0, 100.0]
            },
            {
              "_obj": "pathPointInfo",
              "anchor": [200.0, 200.0]
            }
          ]
        },
        "_options": {
          "dialogOptions": "dontDisplay"
        }
      }
    ],
    {}
  );
}

await require('photoshop').core.executeAsModal(async () => {
  createPath().catch(console.error)
});

```

When running this code, I receive the photoshop alert:

> Perspective Tool: The ‘Make’ command is currently unavailable

I am running this code within an open document and have also attempted to switch to different tools, but the issue persists.

Can anyone offer some guidance? Much appreciated!
