I had a similar problem, I ended up exposing a function to blueprint, creating the UMG Widget there and then passing that into my function.
Then in my function I am using the TakeWidget() from UWidget to get it in SWidget form and setting this to be in my SWindow ‘SlateWin’.
void UControlWindow::SetWidget(UWidget* widget) {
if (SlateWin.IsValid() && widget) {
SlateWin->SetContent(widget->TakeWidget());
}
}
This is with a window that I created and happens during gameplay; so I am unsure how this would work for an editor plugin.