Can I open a Photoshop file with UXP?

To use executeAsModal you need to first import it from photoshop and then you can pass it a function as its parameter to execute that code with Photoshop in a modal state.

// Imports
const { app, core } = require("photoshop");
const fs = require("uxp").storage.localFileSystem;

// Open document helper function
async function openDocument() {
  const pluginFolder = await fs.getPluginFolder();
  const theTemplate = await pluginFolder.getEntry("yourFile.psd");

  // The document is opened 
  await app.open(theTemplate);
}

// Main function - is async so that await can be used within
async function main() {
  // Passing openDocument function to executeAsModal to open file 
  await core.executeAsModal(openDocument);
}

// Run main function from inside try/catch for error handling
try {
  // Don't need to await because a) nothing to run after it and b) you can't anyway because top-level await is not allowed
  main();
} catch (error) {
  console.error(error);
  console.trace(error);
}

EDIT: Code edited to remove error inducing return statements and incorrect imports.