**Why does it crash?**<br> Your code crashes blender because of a `EXCEPTION_ACCESS_VIOLATION`. For further information, see https://docs.blender.org/api/3.3/info_gotcha.html#help-my-script-crashes-blender. (you already know this, just for the sake of completeness) Looking at the report it states: ``` Stack trace: blender.exe :0x00007FF616E36350 BLI_findstring blender.exe :0x00007FF611AE7CF0 IDP_AddToGroup blender.exe :0x00007FF612013EC0 RNA_property_string_set blender.exe :0x00007FF61658A070 file_browse_exec blender.exe :0x00007FF611DA05D0 wm_handler_fileselect_do blender.exe :0x00007FF611DA1F60 wm_handlers_do_intern blender.exe :0x00007FF611DA1390 wm_handlers_do blender.exe :0x00007FF611DA7920 wm_event_do_handlers blender.exe :0x00007FF611D8D820 WM_main blender.exe :0x00007FF610E82360 main blender.exe :0x00007FF617069750 __scrt_common_main_seh KERNEL32.DLL :0x00007FFB5D017600 BaseThreadInitThunk ntdll.dll :0x00007FFB5EF226D0 RtlUserThreadStart ``` Therefore I assume base on `BLI_findstring` the location of the `folder:StringProperty` has changed in memory after the selection, which then causes an `EXCEPTION_ACCESS_VIOLATION`. Another attempt of explanation could be to add the following to the `folder:StringProperty`: ``` def get_folder(self): return self.get("folder", "") def set_folder(self, value): self["folder"] = value folder: bpy.props.StringProperty(name="Choose Folder", subtype="DIR_PATH", get=get_folder, set=set_folder) ``` This will cause the following error: ``` Traceback (most recent call last): File "\Text", line 18, in set_folder TypeError: unsubscriptable object File "\Text", line 16, in set_folder Traceback (most recent call last): File "\Text", line 16, in get_folder ``` because an instance of `SelectDirExample` is unsubscriptable to `self['key'] = value`. This getter, setter implementation maybe prevent the blender from crashing, because the default and setter, getter function are overwritten. **Solution**<br> I don't think an easy solution like this is possible because you are using a dialog which is a floating window and the folder selection will overwrite the current floating window. Also take a look at the info area/info-log of Blender, the Operator isn't executed/registered. Which means it hasn't returned `{'FINISHED'}` and `execute` was never called. Therefore, to implement something like this, you would need to call operator `SelectDirExample` again. ```python import bpy from bpy.types import Operator, PropertyGroup class SelectDirExample(Operator): bl_idname = "object.select_dir_example" bl_label = "Select Dir Example" bl_options = {'REGISTER', 'UNDO'} instances = 0 invoked = False def setter_getter(name: str): return { 'get': lambda self: getattr(bpy.context.scene.selected_dir, name), 'set': lambda self, value: setattr(bpy.context.scene.selected_dir, name, value) } input1: bpy.props.FloatProperty(name="Input 1", default=1.0, min=0.0, max=100.0, **setter_getter('input1')) input2: bpy.props.FloatProperty(name="Input 2", default=1.0, min=0.0, max=100.0, **setter_getter('input2')) def get_folder(self): return bpy.context.scene.selected_dir.folder def set_folder(self, value): props = bpy.context.scene.selected_dir props.folder = value if SelectDirExample.instances != 0 or not SelectDirExample.invoked: return SelectDirExample.instances += 1 bpy.ops.object.select_dir_example("INVOKE_DEFAULT", input1=props.input1, input2=props.input2, folder=props.folder) SelectDirExample.instances -= 1 SelectDirExample.invoked = False folder: bpy.props.StringProperty(name="Choose Folder", subtype="DIR_PATH", get=get_folder, set=set_folder) def invoke(self, context, event): SelectDirExample.invoked = True return_code = context.window_manager.invoke_props_dialog(self, width = 300) return return_code def execute(self, context): input1 = self.input1 input2 = self.input2 folder = self.folder # My processing goes here print(f"Folder location is: {folder}") # Finished processing. SelectDirExample.invoked = False return {'FINISHED'} class SelectDirExample_Props(PropertyGroup): input1: bpy.props.FloatProperty(name="Input 1", default=1.0, min=0.0, max=100.0) input2: bpy.props.FloatProperty(name="Input 2", default=1.0, min=0.0, max=100.0) folder: bpy.props.StringProperty(name="Choose Folder", subtype="DIR_PATH") def register(): bpy.utils.register_class(SelectDirExample) bpy.utils.register_class(SelectDirExample_Props) bpy.types.Scene.selected_dir = bpy.props.PointerProperty(type=SelectDirExample_Props) def unregister(): bpy.utils.unregister_class(SelectDirExample) bpy.utils.unregister_class(SelectDirExample_Props) del bpy.types.Scene.selected_folder if __name__ == "__main__": register() ``` To not cause an `EXCEPTION_ACCESS_VIOLATION` another variable is used to store the folder path (which could also be inside the `AddonPreferences`). `setter_getter` is used to store the values into the same `PropertyGroup` as the folder. Otherwise, these values could not be moved along with the new operator call. They would be their default values because somehow the `self` in the `set_folder` is not the same as the `self` in the `execute` or `invoke`. A new instance with the stored variables will then be launched immediately, and it looks like before (only a movement in location of the dialog). The `SelectDirExample.invoked` variable is need otherwise it would launch two dialogs if the folder parameter is used on calling the operator e.g., `bpy.ops.object.select_dir_example('INVOKE_DEFAULT', folder='<my_path>')`. This does not apply if the call is from `set_folder`.