Polymorphism and Module help?

If I create a parent class called main (containing various arrays and functions) and save in a python file as main_cp.py(I can’t do it all in one file for my specific script, I need two scripts to communicate), is there a special place that I need to save it for it to be able to be imported? I tried creating a new script in the exact same directory as main_cp.py and then importing main but it couldn’t be found. This is the main class:

class main():
     guides = []
     constraints = []
     bones = []

And this is how I tried to import and inherit:

#import main_cp
from main_cp import main

class arm(main):
     pass

Works for me…

Error messages are also helpful.

any module you import must reside in the module search path. You can check which those are by typing the following in Blenders interactive python console:


import sys
print sys.path

Normally you would find one or more directories from Blenders scrips directory. Location may vary by platform, but the one ending in .blender\scripts\bpymodules might be a good choice to store a shared module.