I’m not sure what you are trying. Is it for Server Connect?
You can have a look at the core module which holds the exec action.
In NodeJS the important part of the exec action is:
await this.exec(await fs.readJSON(`app/modules/lib/${options.exec}.json`), true);
That will load the json and execute it. The exec action also has some code to create a new data scope.