0

I'm not sure what I'm trying to do is possible, but I'm trying to write a NodeJS application that needs to call some Python functions, the way I'm going to use Python functions is similar to How to call Python function from NodeJS by using child_process

If the python script had a few imports that had a slight delay when running the script, if you were calling the python script often surely it would cause problems for the applications running time. Is there a way to get around to constantly keep a child process python call open and then call a function whenever it's needed?

Thanks

w13rfed
  • 355
  • 5
  • 12

1 Answers1

1

There's nothing specific to Python nor node.js here. If you don't want the overhead of spawning a child process, make the "other" script / application / whatever a long running process and use any kind of inter-process communication.

bruno desthuilliers
  • 75,974
  • 6
  • 88
  • 118
  • Here is a good article / example for Node/Python and when you don't want to spawn a child process: https://ianhinsdale.com/post/communicating-between-nodejs-and-python/ – mrp May 03 '18 at 03:24