I am writing a series of modules that:
- contain functions to automate common activities in Spaceclaim (V232)
- create some standard workflows
I would like to write the module functions as if they're in the main script, but will work turnkey when moved into a module (easier for debugging). I had two issues with writing simple function modules that meet my above goals:
When scripting in the main module, it has access to an extensive list of globals that imported modules do not have access to. This can be overcome with a function that creates module level globals from the main script (shown below). This feels like a messy solution, but seems to work.
When inspecting objects, I found they have different methods / attributes depending on whether they were in the main script or the module. I'm sure the way around this is to assign a type to the module level, but I was curious about a more global solution.
The example I've shown is for a straight line curve object from GetRootPart(). I'd like my modules to have access to the EvalMid() method without recreating the functionality or getting it from somewhere else. Another annoying difference between the main script and the module is the Get/Set and Name methods. Object.Name() works everywhere, but Object.GetName() works only in the main script.
I've made it pretty far by writing the modules differently from the main script and getting around these limitations, but I'd like to establish best practices before I'm too far down the line. Open to any suggestions / improvements.


