Python script to set viewport to newly created camera

Looking for some help to try and figure out how to set the active viewport to look through the newly created camera, via Python and outside game mode.

Well I guess not much help on here. Took me hours to figure this out. Really wish there was better documentation for Python users in Unreal dev:

unreal.VCamBlueprintFunctionLibrary.pilot_actor(camera_actor)

You could also try

#Select a camera in your level
actor = unreal.EditorLevelLibrary.get_selected_level_actors()[0]
unreal.EditorLevelLibrary.pilot_level_actor(actor)
1 Like

That helped me a bit, thanks! I’m working with a level sequence and trying to do this, but I noticed it only works if I’m using a cinematic viewport and not a regular one. Is there a fix for that? Also I’ve noticed that in the sequencer it doesn’t actually ‘pilot’ the camera…this command won’t click the little camera icon in the track.