# How reload module button works?

**URL:** https://discourse.slicer.org/t/how-reload-module-button-works/1085
**Category:** Development
**Created:** [September 18, 2017, 1:18pm UTC](https://discourse.slicer.org/t/how-reload-module-button-works/1085 "2017-09-18T13:18:38Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ktdiedrich](https://avatars.discourse-cdn.com/v4/letter/k/a698b9/32.png) [@ktdiedrich](https://discourse.slicer.org/u/ktdiedrich)
#### Post date: [September 18, 2017, 1:18pm UTC](https://discourse.slicer.org/t/how-reload-module-button-works/1085/1 "2017-09-18T13:18:38Z")

</div>

Hi,  
Is the “Reload” button supposed to work in a ScriptedLoadableModuleTemplate right after creating it in the Extension Wizard? Or does something have to be set in the code?

I created a couple ScriptedLoadableTemplateModule with the Extension Wizard and then made some small changes to [ScriptedLoadableModuleTemplate.py](http://ScriptedLoadableModuleTemplate.py): self.parent.contributors and self.parent.acknowledgementText and pressed “Reload” but the changes don’t show up until I press “Restart Slicer” button and restart Slicer.

The “Enable Developer Mode” is checked.  
It’s Slicer 4.6.2 on Mac OS X, binary version. I’m only tying to add in Python Modules.  
I added the new ScriptedLoadableModuleTemplate directory (which are outside the Slicer installation directory) to the “Additional module paths:” and the added modules show up with the current changes when Slicer starts.

Best regards,  
Karl

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [September 19, 2017, 2:59pm UTC](https://discourse.slicer.org/t/how-reload-module-button-works/1085/2 "2017-09-19T14:59:22Z")

</div>

Use the latest nightly version, it should work correctly there. If you have trouble with latest nightly version, too, then let us know.

---

<div class="post-metadata">

### Author: ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)
#### Post date: [November 27, 2017, 4:44pm UTC](https://discourse.slicer.org/t/how-reload-module-button-works/1085/3 "2017-11-27T16:44:34Z")

</div>

Would it make sense to have the Python (script) CMake install step create a symlink from the runtime directory to the original script source in the source directory, on platforms where user symlink is supported? This would avoid the rebuild (make/ninja/etc.) step required to copy modified scripts from source tree to runtime directory before they can be reloaded…

I guess this could be as simple as changing the `copy` command to `create_symlink` in [ctkMacroCompilePythonScript](https://github.com/commontk/CTK/blob/master/CMake/ctkMacroCompilePythonScript.cmake#L120-L123). But I think that will break packaging unless the copy step is done somewhere else, or if CPack can be told to follow symlinks. cc @jcfr @pieper

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [November 28, 2017, 3:29am UTC](https://discourse.slicer.org/t/how-reload-module-button-works/1085/4 "2017-11-28T03:29:45Z")

</div>

During development, I just add the source folder (not the install folder) to “Additional module paths” for scripted modules.

---

<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: [November 28, 2017, 1:48pm UTC](https://discourse.slicer.org/t/how-reload-module-button-works/1085/5 "2017-11-28T13:48:17Z")

</div>

Hi Karl - changing the template after generating the module shouldn’t have any effect but changes to the generated scripted module should take effect after hitting the Reload button.

Like @lassoan during development I use Reload all the time. I don’t put the code in the Slicer tree and I typically don’t rebuild scripted modules during development. I run Slicer with the --additional-module-paths option followed by the list of module directories I want to test (since I often have several going at once and don’t want to change my settings).

@ihnorton I prefer to avoid things like symlinks that are not consistent across platforms.

---

<div class="post-metadata">

### Author: ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)
#### Post date: [November 28, 2017, 2:45pm UTC](https://discourse.slicer.org/t/how-reload-module-button-works/1085/6 "2017-11-28T14:45:34Z")

</div>

> [@pieper](#):
>
> I prefer to avoid things like symlinks that are not consistent across platforms.

Alright. Win10 Fall Creators Update does (finally) provide unprivileged symlinks, but it will take a while before that can be generally relied upon.
