Short version: You shouldn't, but I guess you could try signal passing.
Longer version: A major (though perhaps philosophical) point of UI Tests is that they only evaluate that which is passed to the user, or at least to the user-visible View / Accessibility Hierarchies. Using signal passing or some other method to side-channel information is not supported and is against the aesthetic of the test framework.
Instead, you could evaluate whether or not everything has finished rendering by waiting for a .Hittable predicate on the particular UI elements; or if you have elements that only become interactable once the page has finished loading (a common pattern) you could wait for those to change state.
There are a number of different ways to go about this, but the "right" answer is to find some way that's user-visible that you can evaluate.
... alternatively, have a non-visible UI element in the View Hierarchy that changes state based on the Boolean in question, if you want something that just works and don't care about philosophy.