How to get Editor Window to update immediately in Editor Mode/Play Mode

Trying to make an editor window that will show the distance between two selected gameobjects. I usedOnDrawGizmosSelected() which calls some stuff and successfully calculates the distance. The distance is correct when I log it (OnDrawGizmosSelected called a few times per second when object is selected)

private void OnDrawGizmosSelected()
{
        Distance.CheckSelect();
}

This updates some static variable in my Distance class.

My editor window reads this static variable in OnGUI, but OnGUI is only called sometimes, whereas I want the Distance to be reflected immediately on the window as a read only variable.

private void OnGUI()
{
        EditorGUI.BeginDisabledGroup(true);
        EditorGUILayout.FloatField("Distance: ", Distance.distance);
        EditorGUI.EndDisabledGroup();
}

How do I get my EditorWindow to update instantly in both edit and play mode?

The answer was EditorWindow.Update() … kept searching for things apart from the EditorWindow docs itself