Modules and Namespaces

Jelle Feringa / EZCT Architecture & Design Research jelle.feringa at
Thu Oct 20 17:34:04 CEST 2005

##I'm sorry to stir up such a well discussed topic yet again, but namespaces
are a point of confusion to me...

I took the effort of organizing my Python code (scripting a cad program
calles Rhino) in well defined classes, which would be a terrific thing if I
didn't got stuck in namespace issues.

I have a module that launches the application I'm scripting via win32com;

from rhino import load
RS = load.RS

So the application, with all its methods are now available through the RS
(RhinoScript) object

from rhino import SRF # is where things get stuck

The RS object is the application scripted via COM, where all its method
In my module, SRF, I'm not importing anything, though it refers to the RS
object all the time.
Such as:

class srfBase:
    '''Base class inherited by the srf* classes, binding general Rhino
surface functionality to a particular
    surface generation method'''
    def __init__(self):   = ' srfBase'
    def isBrep(self):
        return RS.IsBrep(
    def isPointInSurface(self, coord):
        return RS.IsPointInSurface(, coord)

How do I make the RS object available to the imported SRF module, such that
my module code and program code both refer to RS as the application object
being scripted?



More information about the Python-list mailing list