I am new to child_process and I want to experiment with its capabilities.
Is there any way to pass a function and arguments to a python file, using spawn (or exec or execFile is spawn cannot do it)?
I want to do something like (pseudocode)
spawnORexecORexefile (python path/to/python/file function [argument1, argument2] )
or maybe
spawnORexecORexefile (python path/to/python/file function(argument1, argument2) )
Please explain and maybe give an example, because I am a newbie
How I am doing it now?
in node
var process = spawn('python', [path/to/pythonFile.py, 50, 60] );
in pythonFile.py
import sys
import awesomeFile
hoodie = int(sys.argv[1])
shoe = int(sys.argv[2])
awesomeFile.doYourMagic().anotherThing(hoodie, shoe)
as you can see, from node, I send data to pythonFile and then to awesomeFile, to a specific function
I would like to "cut the middle man" and remove the pythonFile and send data from node directly to the awesomeFile file, to a specific function. This is why I am asking
Thanks