I am new to node's child_process and I am trying to execute python and get its results back to node
I want to use exec, not to execute a simple command but to access a python file and execute it
Say my python.py is
try :
import anotherPythonFile
print('hello2')
# anotherPythonFile.names().getNames()
except Exception as e :
print(e)
I try to test this and have hello2 returned ,but I get nothing
exec('D:\prjt\test\python.py', (er, stdout, stderr)=>{
console.log('exec test', stdout);
})
If this worked I would uncomment and execute anotherPythonFile.names().getNames()
What is the error here?
Also, can I access the anotherPythonFile directly and somehow set the function I want to execute ? I want to do (example)
exec('D:\prjt\test\anotherPythonFile.py.names().getNames()', (er, stdout, stderr)=>{
console.log('exec test', stdout);
})
Is this possible?
Thank you