Scripted Extension inheretance

Hi everyone!

I was wondering if it was possible to set up an extension that defines a base module type that other modules can then inherit.

Basically what I would like is to have a set of classes that extend the SlicerLoadableModule, then another set extending those classes, e.g.:

class foo(ScriptedLoadableModule):

class fooWidget(ScriptedLoadableModuleWidget):

class fooLogic(ScriptedLoadableModuleLogic):

class bar(foo):

class barWidget(fooWidget):

class barLogic(fooLogic):

Is it possible to have a set up like this in slicer? Right now I can’t seem to get slicer to detect and load the module when I have it scan the extension directory.


Yes, that should work in theory. You’ll need to be careful about the directories because the module discover process expects to have a working set of module classes that match the filename of the .py file, so you may need to put the abstract classes into a lib folder.

1 Like