# Persist directory chosen

**URL:** <https://discourse.slicer.org/t/persist-directory-chosen/9368>\
**Category:** Development\
**Created:** [December 3, 2019, 2:55pm UTC](https://discourse.slicer.org/t/persist-directory-chosen/9368 "2019-12-03T14:55:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![giovform](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/giovform/32/4687_2.png) [@giovform](https://discourse.slicer.org/u/giovform)\
**Post date:** [December 3, 2019, 2:55pm UTC](https://discourse.slicer.org/t/persist-directory-chosen/9368/1 "2019-12-03T14:55:11Z")

</div>

Hi! I was wondering, what is the best way to persist (after closing Slicer) the directory a user has chosen in a module I am creating. I initially thought about saving this information in .slicerrc.py and ended asking here because maybe there is some utility function to do this kind of thing.

Thanks!

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [December 3, 2019, 3:11pm UTC](https://discourse.slicer.org/t/persist-directory-chosen/9368/2 "2019-12-03T15:11:48Z")

</div>

I believe you have access to QSettings. You could use that with a well chosen prefix to save intersession values.

This is for users who don’t save their scenes. If you have users who save scenes, the module data should be baked into a MRML node of your creation (not as bad as you think).

---

<div class="post-metadata">

**Author:** ![giovform](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/giovform/32/4687_2.png) [@giovform](https://discourse.slicer.org/u/giovform)\
**Post date:** [December 3, 2019, 4:48pm UTC](https://discourse.slicer.org/t/persist-directory-chosen/9368/3 "2019-12-03T16:48:49Z")

</div>

Thanks Adam, the first solution is what I wanted.
