Proces realtime data from Node.js in Python

I have a Node.js script collecting realtime data from motion sensors. I would like to pass each frame of data to a Python script and process the data there. I found a guide on how to send data to Python, but it just opens a lot of Python processes.

Is there a better way to send pass data from Node.js to Python to proces realtime data?


transFunc:function( component, parameters )

        data2Python = Object.values(parameters).join()';

        const spawn = require('child_process').spawn;

        const process = spawn('python', ('./', data2Python));
        process.stdout.on('data', function (data) {


import pandas as pd
import sys

data = int(sys.argv(1)) # 3

def calculate_stuff(data):

    # do something with the data