"Add Component" by Python

I’m trying to do the same thing but via editor utility widgets. The component shows up for a few seconds in the world and then disappears, and its never added in the details panel for the selected/target actor. Did you ever find a way to do this?