Running independent Python instance with loaded script from R

Is there any possibility to run instance of Python with loaded specified script from R as I did in VBA below:

Sub Script_Daily_Launcher()
    Dim objShell As Object
    Dim PythonExe, PythonScript As String
    
    Set objShell = VBA.CreateObject("WScript.Shell")
    
    PythonExe = """path to Python"""
    
    PythonScript = "path to my script"
    
    objShell.Run PythonExe & PythonScript, , True
    
    ActiveWorkbook.RefreshAll
    
    
End Sub

I have heard about reticulate package but it is running Python inside R and I just want something more easier to just call Python instance directly from R. Thanks in advance for any help.

what is not easy about using reticulate to run python script for R ?
reticulate is not running python inside R per-se, it creates a binding between your R session and a python binaries so that you can work with Python from R.

You have a specific functions for running a script source_python https://rstudio.github.io/reticulate/articles/calling_python.html#sourcing-scripts-1

If you really want to just execute some binaries as any arbitrary binaries from R, you can look at processx package for example.

Anyway, I would really use reticulate for that

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.