# Slicer qt-loadable-modules as libraries to support other modules

**URL:** <https://discourse.slicer.org/t/slicer-qt-loadable-modules-as-libraries-to-support-other-modules/21594>\
**Category:** Development\
**Created:** [January 24, 2022, 8:58am UTC](https://discourse.slicer.org/t/slicer-qt-loadable-modules-as-libraries-to-support-other-modules/21594 "2022-01-24T08:58:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![RafaelPalomar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rafaelpalomar/32/1436_2.png) [@RafaelPalomar](https://discourse.slicer.org/u/RafaelPalomar)\
**Post date:** [January 24, 2022, 8:58am UTC](https://discourse.slicer.org/t/slicer-qt-loadable-modules-as-libraries-to-support-other-modules/21594/1 "2022-01-24T08:58:13Z")

</div>

Hello,

for **Slicer-Liver** , we are thinking about the modularity of the extension. We have a set of components already developed in C++, but would like to have a `qt-scripted-module`, featuring a single UI, be an entry point for our researchers to interact with and fast-prototype new ideas. We are currently thinking about two designs and would like to hear your opinion about their feasibility and your recommendation.

**Single hybrid module**

A single `qt-scripted-module` containing also C++ qtwidgets, logic, nodes, markups, etc., in the same module.

**A set of `qt-loadable-modules` providing the core components + a `qt-scripted-module` providing the module UI and connecting the components**

A set of `qt-loadable-modules` providing the core components (nodes, markups, qt-widgets, logics, etc.) and a `qt-scripted-module` that will feature a unified interface and connect the components. The `qt-loadable-modules` would be used as libraries for the `qt-scripted-module`, so they will be hidden and won’t have any module interface.

I thank you in advance for your feedback.

---

<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:** [January 24, 2022, 7:00pm UTC](https://discourse.slicer.org/t/slicer-qt-loadable-modules-as-libraries-to-support-other-modules/21594/2 "2022-01-24T19:00:26Z")

</div>

I’d say either of those could work fine. I might favor keeping all the C++ code in loadable modules and have only python code in a scriptable module, which I guess is your second option. I suppose it also depends on how many files you will end up with and whether a single module for all of it would get cluttered. Keeping them separate might encourage modularity and reusability.

---

<div class="post-metadata">

**Author:** ![RafaelPalomar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rafaelpalomar/32/1436_2.png) [@RafaelPalomar](https://discourse.slicer.org/u/RafaelPalomar)\
**Post date:** [January 27, 2022, 2:39pm UTC](https://discourse.slicer.org/t/slicer-qt-loadable-modules-as-libraries-to-support-other-modules/21594/3 "2022-01-27T14:39:25Z")

</div>

Thanks @pieper. This is useful for us to decide.

---

<div class="post-metadata">

**Author:** ![herryliq](https://avatars.discourse-cdn.com/v4/letter/h/3bc359/32.png) [@herryliq](https://discourse.slicer.org/u/herryliq)\
**Post date:** [May 15, 2024, 7:18am UTC](https://discourse.slicer.org/t/slicer-qt-loadable-modules-as-libraries-to-support-other-modules/21594/4 "2024-05-15T07:18:30Z")

</div>

I currently have the same requirement, where there are many core modules written in C++ that need to be associated with a UI written in Python.  
Could you share your implementation ideas and some key issues you encountered?

---

<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:** [May 15, 2024, 11:58am UTC](https://discourse.slicer.org/t/slicer-qt-loadable-modules-as-libraries-to-support-other-modules/21594/5 "2024-05-15T11:58:55Z")

</div>

This SlicerLiver code is here, so you can have a look: [GitHub - ALive-research/Slicer-Liver: 3D Slicer extension for liver analysis and therapy planning](https://github.com/ALive-research/Slicer-Liver)

---

<div class="post-metadata">

**Author:** ![herryliq](https://avatars.discourse-cdn.com/v4/letter/h/3bc359/32.png) [@herryliq](https://discourse.slicer.org/u/herryliq)\
**Post date:** [May 18, 2024, 12:37am UTC](https://discourse.slicer.org/t/slicer-qt-loadable-modules-as-libraries-to-support-other-modules/21594/6 "2024-05-18T00:37:04Z")

</div>

Thank you very much, I will try to read it. 😀

---

<div class="post-metadata">

**Author:** ![RafaelPalomar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rafaelpalomar/32/1436_2.png) [@RafaelPalomar](https://discourse.slicer.org/u/RafaelPalomar)\
**Post date:** [June 10, 2024, 12:26pm UTC](https://discourse.slicer.org/t/slicer-qt-loadable-modules-as-libraries-to-support-other-modules/21594/7 "2024-06-10T12:26:08Z")

</div>

@herryliq Don’t hesitate to reach out if you have specific questions about how we implemented this in SlicerLiver 🙂
