Skip to content

pyui.select_folder

Daniel Flassig edited this page Jul 7, 2026 · 3 revisions

Displays the system folder-selection dialog and returns a path handle to the folder the user picks.

pyui.select_folder(access, scope, title, old_path)

Parameters

Parameter Type Description
access string The access to request for the selected folder. One of "read" (read only) or "full" (create, modify and delete files).
scope string (optional) How much of the folder is made accessible. One of "folder" (the folder and its direct files, the default) or "recursive" (the folder and its complete sub-tree).
title string (optional) The text shown in the title bar of the dialog.
old_path path handle (optional) A path handle that refers to a folder. It is used to pre-select a starting folder in the dialog.

Return value

Type Description
path handle A path handle to the selected folder, carrying the requested access level. Returns nil if the user cancels the dialog.

Remarks:

When access is "full", the user is asked to explicitly confirm write access to the chosen folder. If the confirmation is declined, the function returns nil as though the dialog had been cancelled.

The resulting handle carries the access level that matches scope: "folder" yields a directory handle, "recursive" yields a recursive handle.

Example:

local folder = pyui.select_folder("full", "recursive", "Choose an export folder")
if folder then
	local target = folder:append_path("export.pyo")
	pytha.export_pyo(target, my_group)
else
	pyui.alert("No folder was selected.")
end

Version Support:

Minimum PYTHA Version: V26

See also:

pyui, Path Handles, pyio.append_path, pyio.list_folder

Clone this wiki locally