How does one access the Hierarchy Window?

I'm setting the HideFlags of certain GameObjects to HideInHierarchy, however, in order to refresh it, I have to create a game object and delete it from the hierarchy. I need to be able to refresh it (repaint) via script. Has anyone gotten access to it?

Thanks ahead of time.

EditorApplication.RepaintHierarchyWindow

Two ideas, both untested ...

  1. You could use EditorApplication.ExecuteMenuItem to invoke "Window/Hierarchy", maybe that would trigger a refresh?
  2. Or perhaps EditorGUIUtility.PingObject would help?