My question is essentially the title. I currently have a file/module for running python scripts. Lets call it script.js which looks like this:
const PythonShell = require('python-shell').PythonShell;
class AHK {
static async runScript() {
PythonShell.run('/ahk/runScript.py', null, function (err) {
if (err) throw err;
console.log('finished');
});
}
static async runOtherScript() {
PythonShell.run('/ahk/runOtherScript.py', null, function (err) {
if (err) throw err;
console.log('finished');
});
}
}
module.exports = AHK;
I have my main.js file which imports this module and executes the function and looks like this:
const AHK = require("./ahk");
AHK.runScript();
Right now I have the python script ending after a certain amount of time. I'd like to have it so I can run the python script until something changes on the js side, kill that script, and then start the other one. Pseudo code for this would be something like:
const AHK = require("./ahk");
AHK.runScript();
if(requirement = true){
// kill AHK.runScript() here
// start AHK.runOtherScript();
}
or something along this line