Answer the question
In order to leave comments, you need to log in
How to call a Python function from Node.js and vice versa?
How can one call a function in nodejs from Python and vice versa from a nodejs function call a function in Python?
Answer the question
In order to leave comments, you need to log in
Why call each other? Both are server languages, both can act as a web server. So make two microservices, in python and node, and let them shoot at each other with data.
const spawn = require('child_process').spawn;
const ls = spawn('ls', ['-lh', '/usr']);
ls.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
ls.stderr.on('data', (data) => {
console.log(`stderr: ${data}`);
});
ls.on('close', (code) => {
console.log(`child process exited with code ${code}`);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question