Is it possible to pass arguments to RunPythonScript?

I’m trying to spawn multiple Rhino instances with a python script and make them load the same script that started them, but run it differently. I thought that it can be achieved by passing arguments to -RunPythonScript command like this:

-RunPythonScript ("C:\\Scripts\\test.py -testytestytest")

test.py:

import sys

print(sys.argv[1])

but this error pops up:

A workaround:

# when calling subprocess Popen
/runscript="-SetDocumentUserText Key Value -RunPythonScript ("C:\\Scripts\\test.py")

test.py

import rhinoscript as rs

print(rs.GetDocuementUserText("Key"))

image

2 Likes

Just wondering if there’s a better way of doing this in 2025.

Essentially I want to pass any argument to tell the script if the user called it using right or left mouse button.