How to use a tool script to disable selecting nodes through viewport

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Hubber116sx

I’m creating a custom node for the editor that needs to disable the ability to select nodes through the editor’s viewport (Specifically the 2D viewport if that makes a difference).
Is there a way to use a tool script to disable the ability to select nodes through the editor’s viewport?