How call the functions that are attached to the viewport toolbar

I am trying to call functions that are being called with the viewport editor. In order to toggle the pilot actor or go into game view, what would be the steps to extract those functions from the engine? I have tried to init and call the functions through pointers, but as soon as I build and click on the button within my editor utilty widget, the engine crashes or sends out a fatal error about the shared pointer.h script i believe it’s line 846?

Does anyone have any suggestions on extraction functions fro, the toolbars in editor?