Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
Elimine el script PythonShell.run() cuando se cumpla la condición e inicie otro script

Mi pregunta es esencialmente el título. Actualmente tengo un archivo/módulo para ejecutar scripts de python. script.js que se ve así:

 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;

Tengo mi archivo main.js que importa este módulo y ejecuta la función y se ve así:

 const AHK = require("./ahk"); AHK.runScript();

En este momento, tengo el script de Python que finaliza después de una cierta cantidad de tiempo. Me gustaría tenerlo para poder ejecutar el script de python hasta que algo cambie en el lado js, eliminar ese script y luego iniciar el otro. El pseudocódigo para esto sería algo como:

 const AHK = require("./ahk"); AHK.runScript(); if(requirement = true){ // kill AHK.runScript() here // start AHK.runOtherScript(); }

o algo por el estilo

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!