Select a Prim by Prim Path
USD does not have a concept of a selection, but in Kit, you can select prims enabling users and extensions to then use manipulators and tools on the selection or perform actions upon the selection. These snippets shows you how you can select one or more prims by their prim paths.
import omni.usd
prim_path = "/World/My/Prim"
ctx = omni.usd.get_context()
# The second arg is unused. Any boolean can be used.
ctx.get_selection().set_selected_prim_paths([prim_path], True)
import omni.kit.commands
import omni.usd
prim_path = "/World/My/Prim"
ctx = omni.usd.get_context()
old_selection = ctx.get_selection().get_selected_prim_paths()
omni.kit.commands.execute('SelectPrimsCommand',
old_selected_paths=old_selection,
new_selected_paths=[prim_path],
expand_in_stage=True) #DEPRECATED: Used only for backwards compatibility.