title: Why can't I return stdout variable in this exec function?
body: <p>I got a function to call an exec in <strong>node.js</strong> server. I'm really lost about getting the stdout back. This is function:</p>
  
  <pre><code>function callPythonFile(args) {
  
      out = null
      var exec = require('child_process').exec,
      child;
  
      child = exec("../Prácticas/python/Taylor.py 'sin(w)' -10 10 0 10",
  
      function (error, stdout, stderr) {
  
      console.log('stderr: ' + stderr)
      if (error !== null) 
          console.log('exec error: ' + error);
      out = stdout
      })
      return out
  }
  </code></pre>
  
  <p>When I call to <code>console.log(stdout)</code> I actually get an output. But when I try to print outside the function, it's output, it'll always be null. I can't really see how I can get it</p>