# Extension settings in C++ code

**URL:** https://discourse.slicer.org/t/extension-settings-in-c-code/28251
**Category:** Development
**Tags:** python
**Created:** [March 9, 2023, 8:06am UTC](https://discourse.slicer.org/t/extension-settings-in-c-code/28251 "2023-03-09T08:06:11Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![dsa934](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dsa934/32/17907_2.png) [@dsa934](https://discourse.slicer.org/u/dsa934)
#### Post date: [March 10, 2023, 4:31pm UTC](https://discourse.slicer.org/t/extension-settings-in-c-code/28251/5 "2023-03-10T16:31:07Z")

</div>

@jamesobutler

To clarify the question, let’s assume that we are going through an extension with a python version.

Through the extension wizard, you can create the following structure through the process of creating an extension and adding a module.

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/d/edc78fcd1f3b49750d082bdd4f182bdd1e8d3f58.png)

Now I need to add my module to custom\_extenion.py .

> [@Private Extension my own python code](https://discourse.slicer.org/t/private-extension-my-own-python-code/27285/8):
>
> Hello again Unfortunately, since the slicer version has been unified( in my company), it cannot be changed. There is no problem with this configuration in my version either. The current problem situation is that the problem occurs from the moment the custom code is added. I temporarily solved the problem by replacing it with a method of adding code through the ‘Ctrl+r’ short cut key, but I’m still curious about the sure method for the extension. The above structure is automatically formed …

If I didn’t misunderstand your previous reply, I understood that I had to keep the framework for class (ScriptedLoadableModule/ScriptedLoadableModuleWidget/ScriptedLoadableModuleLogic) of custom\_extension.py and paste my code below it.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/1/c18e1e6a3a1c9db51edc14b600d4cf5de9235b5a.png)

Therefore, I pasted my code in the empty space above(red rectangle) and declared a shortcut key function to perform the extension of the python version. To achieve the above method, I went through the process of modifying my module, which was previously composed of several files, into a single file.

I was curious about how to extend without merging into one file. Isn’t the cmakelist.txt you mentioned used when building in code using c++?

Are you saying that when adding a module composed of multiple files to 3d slicer, regardless of the version(python, c++ ), all cmakelist.txt should be modified?

---

_[View the full topic](https://discourse.slicer.org/t/extension-settings-in-c-code/28251)._
