All docs
Context·
property
Context.selection
the user's current selection, if any
Python
selection: Selection
Returns Selection — the current selection (entities/rows), or None
Example#
Python
@tool.command("demo/count_selected")
def count_selected(ctx: Context):
n = len(ctx.selection) if ctx.selection else 0
Notes#
A lazily populated slot — None when nothing is selected or the invoking surface has no selection.
Guard before iterating.
See also#
Guides: Commands & actions
By LSD Team · Last updated Jul 17, 2026
Ask on Discord
View as Markdown