# Reload and Test deletes data

**URL:** <https://discourse.slicer.org/t/reload-and-test-deletes-data/28017>\
**Category:** Support\
**Created:** [February 23, 2023, 4:24pm UTC](https://discourse.slicer.org/t/reload-and-test-deletes-data/28017 "2023-02-23T16:24:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rhodesdante](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@rhodesdante](https://discourse.slicer.org/u/rhodesdante)\
**Post date:** [February 23, 2023, 4:24pm UTC](https://discourse.slicer.org/t/reload-and-test-deletes-data/28017/1 "2023-02-23T16:24:01Z")

</div>

Is there a way to recover data that is removed when one clicks on the “Reload and Test” button on some modules? I have accidentally pressed this button once or twice recently on different modules and it is frustrating to have my data wiped from the scene. Thanks!

---

<div class="post-metadata">

**Author:** ![rhodesdante](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@rhodesdante](https://discourse.slicer.org/u/rhodesdante)\
**Post date:** [February 23, 2023, 4:39pm UTC](https://discourse.slicer.org/t/reload-and-test-deletes-data/28017/2 "2023-02-23T16:39:43Z")

</div>

An example functionality that might be useful for preventing this might be an option in the application settings (next to “Confirm on Restart” checkbox, for example) that is enabled by default that ensures the user actually wants to reload and test, and warns that it will delete the scene’s data

---

<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:** [February 23, 2023, 6:32pm UTC](https://discourse.slicer.org/t/reload-and-test-deletes-data/28017/3 "2023-02-23T18:32:51Z")

</div>

The Reload and Test feature is exposed only in developer mode and is meant to quickly test new code from a fresh start. If others agree, I would be okay a confirmation dialog before closing the scene. It would be just a small change to the `ScriptedLoadableModuleWidget` base class.

---

<div class="post-metadata">

**Author:** ![rhodesdante](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@rhodesdante](https://discourse.slicer.org/u/rhodesdante)\
**Post date:** [February 23, 2023, 8:51pm UTC](https://discourse.slicer.org/t/reload-and-test-deletes-data/28017/4 "2023-02-23T20:51:40Z")

</div>

That would certainly help me prevent accidentally closing the scene–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:** [February 23, 2023, 9:02pm UTC](https://discourse.slicer.org/t/reload-and-test-deletes-data/28017/5 "2023-02-23T21:02:36Z")

</div>

Would you be able to draft a PR?

---

<div class="post-metadata">

**Author:** ![rhodesdante](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@rhodesdante](https://discourse.slicer.org/u/rhodesdante)\
**Post date:** [February 23, 2023, 9:27pm UTC](https://discourse.slicer.org/t/reload-and-test-deletes-data/28017/6 "2023-02-23T21:27:51Z")

</div>

I can certainly give it a try, but I have never done so before. Is there a tutorial for this I can follow?

---

<div class="post-metadata">

**Author:** ![rhodesdante](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@rhodesdante](https://discourse.slicer.org/u/rhodesdante)\
**Post date:** [February 23, 2023, 9:47pm UTC](https://discourse.slicer.org/t/reload-and-test-deletes-data/28017/7 "2023-02-23T21:47:18Z")

</div>

Nevermind, found it here: [Contributing to Slicer — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/developer_guide/contributing.html#how-to-submit-a-pr). I’ll let you know if I am able to figure this out in a timely manner. Thanks again.

---

<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:** [February 23, 2023, 10:12pm UTC](https://discourse.slicer.org/t/reload-and-test-deletes-data/28017/8 "2023-02-23T22:12:23Z")

</div>

Yes, exactly. You can search in the repository for the `onReloadAndTest` method and consider options to add a dialog (probably a `ctkMessageBox`).
