[UXP for Premiere Pro 25.0+] How to get the active project object? app.project is always undefined.
Hello, I am developing a UXP panel for Premiere Pro (v25.0 or later) with manifest v5.
I am trying to get the active project object, but I am having great difficulty. The object returned by "new Application()" consistently has a null or undefined ".project" property, even when a project is open.
Here is a summary of what I have tried:
-
require('premierepro').app and require('premierepro').project are both undefined.
-
new Application() returns an object, but (new Application()).project is undefined.
-
await new Application() also returns an object, but (await new Application()).project is still undefined.
Here is my minimal test code:
// index.js const Application = require('premierepro').Application; async function testProjectAccess() { console.log("Attempting to get project object..."); try { const app = await new Application(); console.log("Application instance created:", app); if (app.project) { console.log("SUCCESS! Project Name:", app.project.name); } else { console.error("FAILURE: app.project is null or undefined."); } } catch (e) { console.error("An error occurred:", e); } } // Button click handler document.getElementById("myButton").onclick = testProjectAccess;
The console always logs "FAILURE: app.project is null or undefined."
What is the correct and official method to get the active project object in Premiere Pro v25+ UXP scripting? Is there a bug in the current API version?
Thank you.
