hou.selectedNodes function

Return a list of all selected nodes.

selectedNodes(include_hidden = False)tuple of hou.Node

The include_hidden parameter controls whether or not hidden nodes can be returned, even if they are selected.

The current node is always the last selected node.

The following example will print the names of all selected nodes:

for n in hou.selectedNodes():
    print n.name()