Set camera prim as default viewport from python.sh

I am trying to launch my custom USD file in Isaac Sim using the python API by running it as python.sh test_launch_isaac_sim.py

I can successfully run Isaac Sim and see my USD file being loaded but in viewport, I am not able to set the path for a camera prim which is already available in the USD file.

In my USD file, I have a camera prim with path /Root/my_robot/base_link/Camera . I want to set this prim path as the default viewport whenever I load my USD file in Isaac Sim whenever I load it using the Python API.

Here’s a snippet from my code

viewports.set_camera_view(eye=np.array([1.2, 1.2, 0.8]), target=np.array([0, 0, 0.5]))

stage.add_reference_to_stage(BACKGROUND_USD_PATH, BACKGROUND_STAGE_PATH)

Please help me with this. Thank you

you could try using the following snippet (thanks to @mati-nvidia):

import omni.kit.viewport.utility as vu
from pxr import Sdf

vp_api = vu.get_active_viewport()
vp_api.camera_path = "/World/Camera"