# Programatically load/save scenes and saving folders

**URL:** <https://discourse.slicer.org/t/programatically-load-save-scenes-and-saving-folders/30194>\
**Category:** Development\
**Tags:** python\
**Created:** [June 23, 2023, 12:57pm UTC](https://discourse.slicer.org/t/programatically-load-save-scenes-and-saving-folders/30194 "2023-06-23T12:57:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick\_Li](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/patrick_li/32/66178_2.png) [@Patrick\_Li](https://discourse.slicer.org/u/Patrick_Li)\
**Post date:** [June 23, 2023, 12:57pm UTC](https://discourse.slicer.org/t/programatically-load-save-scenes-and-saving-folders/30194/1 "2023-06-23T12:57:43Z")

</div>

For a custom module I was making, I was wondering whether or not it was possible to load and save scenes (MRML files) without user input. For example the scene would save to a directory when the application was closed and would load from a directory when the user selected the module.

---

<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:** [June 23, 2023, 1:14pm UTC](https://discourse.slicer.org/t/programatically-load-save-scenes-and-saving-folders/30194/2 "2023-06-23T13:14:40Z")

</div>

No reason you can’t do that. There’s an `enter` method that gets called when a module is selected. Of course there would need to be logic so the scene doesn’t get loaded multiple times, etc.
