If I understand you correctly, you would like to call a Python script and pass an argument and then perhaps handle the return data object?
If you use Windows and have VBA scripting environment, then perhaps you could use WSH (windows script host) object to run the script. First declare the object
Dim wsh As New IWshRuntimeLibrary.WshShell 'early binding
Dim wsh As Object
Set wsh = CreateObject("Wscript.Shell") ' late binding
And use the Run() method on the object, passing object and argument as string. in this example i call powershell and pass scriptfile (run.ps1) as argument. I just call the method, but don't get the return object from the script.
res = wsh.Run("powershell path\run.ps1", WindowStyle:=False, WaitOnReturn:=True)
If res = 0 Then
Call MsgBox("script ran successfully")
Else
Call MsgBox("script ran unsuccessfully")
End If
In this example on the other hand, I use the Exec method to fetch the return data as json
res = wsh.Exec("powershell path\run.ps1").StdOut.ReadAll()
Debug.Print res ' return data:
returnObject:
{
title: 'theTitle',
value: 'the value',
status: 'status'
}
The run.ps1 basically returns a string:
return "returnObject:
{
title: 'theTitle',
value: 'the value',
status: 'status'
}"
Edit: to call a python script file use python
or py
in place for powershell
res = wsh.Exec("python path\pythonfile.py").StdOut.ReadAll()