# Scripted Extension inheretance

**URL:** <https://discourse.slicer.org/t/scripted-extension-inheretance/22625>\
**Category:** Development\
**Created:** [March 21, 2022, 7:35pm UTC](https://discourse.slicer.org/t/scripted-extension-inheretance/22625 "2022-03-21T19:35:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsims](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tsims/32/11853_2.png) [@tsims](https://discourse.slicer.org/u/tsims)\
**Post date:** [March 21, 2022, 7:35pm UTC](https://discourse.slicer.org/t/scripted-extension-inheretance/22625/1 "2022-03-21T19:35:03Z")

</div>

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.:

foo.py

```auto
class foo(ScriptedLoadableModule):
...

class fooWidget(ScriptedLoadableModuleWidget):
...

class fooLogic(ScriptedLoadableModuleLogic):
...

```

bar.py

```auto
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.

Thanks!

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [March 21, 2022, 7:50pm UTC](https://discourse.slicer.org/t/scripted-extension-inheretance/22625/2 "2022-03-21T19:50:50Z")

</div>

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.
