Just to add 2 cents to the discussion. If the call is right at the beginning of initialization then the widget may not be ready. Adding a delay for local tests (0,2 seconds) proves that if the cast is ok it is valid.
Maybe add a delegate call from the ui once it’s loaded to let the function know it’s safe to access it.

