Call another function within a function


Is is possible to call a python file from within a script in Rhino? In short, I want to read a bunch of inputs from a csv into another function… for cleanliness sake was going to just call the other function from the script in the folder (within the csv function) instead of writing it all out. See below:

import csv
import rhinoscriptsyntax as rs

def CSVlist():
    #prompt the user for a file to import
    filter = "CSV file (*.csv)|*.csv|*.txt|All Files (*.*)|*.*||"
    filename = rs.OpenFileName("Open Point File", filter)
    if not filename: return

    with open(filename) as csvfile:
        reader = csv.reader(csvfile)
        for row in reader:
            x = str(row[0])


Without looking up the details of how to do it, sorry, you just “include” your other script file in the one you’re running.

Hey Jim,

Yeah I figured this would prob be the way without going down a rabbit hole.

I just got it working with including the text in the same file.


Do your module search paths include the location to the external files directory?