# Change default destination folder in Export to files from segmentations module with python

**URL:** <https://discourse.slicer.org/t/change-default-destination-folder-in-export-to-files-from-segmentations-module-with-python/34697>\
**Category:** Support\
**Created:** [March 4, 2024, 4:27pm UTC](https://discourse.slicer.org/t/change-default-destination-folder-in-export-to-files-from-segmentations-module-with-python/34697 "2024-03-04T16:27:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![garridojuan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/garridojuan/32/69557_2.png) [@garridojuan](https://discourse.slicer.org/u/garridojuan)\
**Post date:** [March 4, 2024, 4:27pm UTC](https://discourse.slicer.org/t/change-default-destination-folder-in-export-to-files-from-segmentations-module-with-python/34697/1 "2024-03-04T16:27:10Z")

</div>

I am developing a tool that automatically opens a segmentation mask and the image in 3D Slicer so that the user can modify it. I do it by using --python-code option when executing slicer from terminal.

I would love to have all format options properly pre-established for better user experience. However, I could not find in the documentation where I can change them in the “Export to files” menu of the Segmentations module.

Thank you in advanced.

---

<div class="post-metadata">

**Author:** ![garridojuan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/garridojuan/32/69557_2.png) [@garridojuan](https://discourse.slicer.org/u/garridojuan)\
**Post date:** [April 16, 2026, 10:18am UTC](https://discourse.slicer.org/t/change-default-destination-folder-in-export-to-files-from-segmentations-module-with-python/34697/2 "2026-04-16T10:18:09Z")

</div>

I found the solution, or a workaround at least. You can control the destination folder used in the **“Export to files”** menu of the Segmentations module through application settings.

The path is stored using `qt.QSettings`, so you can predefine it programmatically before the export operation.

Here is how you can set it:

```python
import qt

desiredDestinationFolder = r"here/i/want/my/segmentation"
settings = qt.QSettings()
settings.setValue('ExportSegmentsToFiles/DestinationFolder', desiredDestinationFolder)

```

By setting this value in advance, the export dialog will default to your desired folder, improving the user experience when running your automated workflow.
