title: Can I use the child_process to spawn multiple python outputs on a server?
body: <p>I am trying to use NodeJS to execute multiple python scripts and send the contents of those scripts to a local host. I would like to not be specific to the exact python script, but to use something similar to executing python script that uses ".py".</p>
  
  <p>I have tried to run multiple processes, but the last one overwrote the former on the localhost. </p>
  
  <p>Python scripts:</p>
  
  <p>hellothere.py</p>
  
  <pre><code> print("hello there")
  </code></pre>
  
  <p>helloworld.py</p>
  
  <pre><code> print("Hello World!")
  </code></pre>
  
  <p>Goodbye.py</p>
  
  <pre><code> print("Goodbye!")
  </code></pre>
  
  <p>Pythonspawn.js</p>
  
  <pre><code>var express = require('express');
  
  var app = express();
  
  app.get('/name', function callName(req, res) {
  
      var spawn = require("child_process").spawn;
  
              var PythonProcess1 = spawn('python',["./hellothere.py"] );
              var PythonProcess2 = spawn('python', ['./helloworld.py']);
              var PythonProcess3 = spawn('python', ['./Goodbye.py']);
              PythonProcess1.stdout.on('data', function(data) {
              res.send(data.toString());
              })
              PythonProcess2.stdout.on('data', function(data) {
              res.send(data.toString());            
              })
              PythonProcess3.stdout.on('data', function(data) {
              res.send(data.toString());            
              })
          }
  })   
  app.listen(1820, function() {
      console.log('Server is running on port %d.', this.address().port);
  })
  </code></pre>
  
  <p>I would like to execute any python script that uses ".py" rather than specifying the exact script I want executed. If possible, I would like to also execute the scripts if they have a different amount of arguments. (I.e if helloworld.py had two sys.arg[i] and Goodbye.py had one sys.arg[i].)</p>