Revit 2023 it works >>
However, Revit 2025 I get this error:
Help!
Try it using the IronPython3 or PythonNet engine.
I have to install those?
I’m not trying to pin an instance though?
I want to toggle the setting in Revit to prevent the user from being able to select pinned elements.
Also.. I’m doing it.

Yes - they are packages on the package manager, just be sure to download the right version for your Revit build and change the engine on the Python node.
SelectionUIOptions.GetSelectionUIOptions()
return an instance of SelectionUIOptions ( Returns the current user’s SelectionOptions.)
Thanks. Some of the terminology is pretty confusing.