title: Calling Python from VBA - returning Python function value
body: <p>I call Python script from VBA. The structure of this Python script is a single function without anything else:</p>
  
  <pre><code>def myFunction():
      # do stuff
      return stuff_output
  </code></pre>
  
  <p>I know that this function works properly, because if added, <code>print(myFunction())</code> generates correct output (JSON response) in command line.</p>
  
  <p>In my VBA code 'RetVal` is always a 4 digit integer value. Perhaps Python function isn't even executed?</p>
  
  <p>Which code and how should I fix to make it work? I would appreciate a solution which is close to my current code and without external libraries if possible.</p>
  
  <pre class="lang-vb prettyprint-override"><code>Option Explicit
  
  Sub RunPython()
  
      Dim RetVal
      Dim scriptPath As String
  
      scriptPath = "C:\Users\Rychu\Desktop\python\myPythonScript.py"
      RetVal = Shell("C:\Python36-32\python.exe" &amp; " " &amp; scriptPath, vbHide)
  
      If RetVal = 0 Then
          MsgBox "Couldn't run python script!", vbOKOnly
      Else
          Debug.Print RetVal
      End If
  
  End Sub
  </code></pre>