How to set an object reference of an actor that is spawned in?

Where do you do it? Inside a widget? In another BP after a key press?