Grasshopper

algorithmic modeling for Rhino

Calling more py scripts from the ghpy component?

Hello,

I am currently trying to run a python script using the python add on. 

Thing is this python script calls other scripts from a folder I have in my deskptop.

#===============================================================================
#   File :      straight_skeleton.py
#   Author :    Olivier Teboul olivier.teboul@ecp.fr
#   Date :      11 august 2008, 12151
#   Class:      StraightSkeleton
#===============================================================================

import polygon
import events
from graph import Graph

class StraightSkeleton(Graph):

So, how can I make it so that it imports those files?

Because right now it does not seem to be working.

I found some threads about this, but I really dont understand the syntax at all to reinterpret it to my usage:

http://www.grasshopper3d.com/forum/topics/python-component-adding-r...

This suggests using this string:

import sys
my_path = '/path/to/my/folder/of/code'
sys.path.append(my_path)
import myscripts

Suppose my main code file path is:

C:\Users\Shynn\Desktop\StraightSkeleton\pySkeleton\pySkeleton

And my folder for the other scripts being called is:

C:\Users\Shynn\Desktop\StraightSkeleton\pySkeleton

How do I need to modify the string?

Thanks in advance

Shynn

Views: 412

Replies to This Discussion

Any ideas?

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2025   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service