How do I set the current script as the selection in the project view?

I want to be able to highlight as script in the project view ( as well as use EditorGUIUtility.PingObject() on it if possible ) and I’m having trouble figuring out how to get that to happen.

Does anyone know how to set the Selection to a script by type or instance?

and

Does anyone know how to use PingObject() on a script either by type or instance?

I figured out how to get the current script that I’m editing to be able to ping it.

Let’s say I’m making a custom inspector for something. All I needed to do was get the MonoScript of the object that I’m inspecting.

EditorGuiUtility.PingObject( MonoScript.FromMonoBehaviour( target ) );

This solution doesn’t work on scripts that aren’t MonoBehaviours, but I believe that’s because Unity has no support for pinging scripts that aren’t MonoBehaviours.