This is how I managed to spawn a UMG widget through code
https://answers.unrealengine.com/questions/756759/unable-to-create-widget-no-outer-provided.html
I created the widget in the editor and then used FClassFinder to grab that class, and then spawned it using CreateWidget.