Viewport Camera

Look at a Prim

target_prim_xform_mat = UsdGeom.Xformable(target_prim).GetLocalTransformation()

# The target location (target_loc) is for this particular prim,
# but could also be any arbitrary location
target_loc = target_prim_xform_mat.ExtractTranslation()

viewport = get_active_viewport()
active_camera_path = viewport.camera_path.pathString
camera_pos = self.camera_target_pos

new_cam_mat = Gf.Matrix4d(1.0)
new_cam_mat.SetLookAt(camera_pos, target_loc, Gf.Vec3d(0,1,0))
destXformAttr = self.camera_prim.GetAttribute('xformOp:transform')
destXformAttr.Set(new_cam_mat.GetInverse())

Change the Active Camera

from omni.kit.viewport.utility import get_active_viewport

camera_path = "/World/Camera/MyNewCamera"
viewport = get_active_viewport()

if not viewport:
    raise RuntimeError("No active Viewport")

# Set the Viewport's active camera to the
# camera prim path you want to switch to.
viewport.camera_path = camera_path