Importing Python methods from my own library in Rhino and Grasshopper on macOS?


I have created a Python file, called, with handy functions that work in accordance with rhinoscriptsyntax. I want to be able to import my library in Rhino and Grasshopper Python, but I don’t know where I have to put the
To be clear I want to be able to import the methods of in other Rhino Python scripts and within the Grasshopper Python Component. I have the latest version of Rhino 5 for macOS!

Any Ideas?

Thank you.

Put it in the same folder rhino stores it’s scripts in by default. When you type ‘_EditPythonScript’ rhino will show you the location. You can import any python file in the scripts folder into ghpython nodes and rhinopython scripts it’s as simple as writing

Import my

In Rhino for Mac, ‘_EditPythonScript’ is an unknown command. It doesn’t open the Script Editor like on Windows. All you can do to run Python script is, use the command ‘RunPythonScript’, which just opens a system dialogue, where you can select your Python file and upon confirmation, Rhino will run it in the background.

Run this in a GhPython component, it will tell you all the locations the import statement searches in.

import sys
print '/n'.join(sys.path)

(you can also append to the sys.path like any other list to tell it to look in a specific location)

The main scripts folder should be in ~/Library/Application Support/McNeel/Rhinoceros/scripts


Thanks, qythium. Worked like a charm!