How to access World handle in a standalone app when loading a USD stage


I created a scene and saved it as USD. Now I would like to import this scene from Python and obtain the World handle to access the robots in the scene and print some information. I tried this code:

#launch Isaac Sim before any other imports
#default first two lines in any standalone application
import carb
import omni
from omni.isaac.kit import SimulationApp
kit = SimulationApp({"headless": False}) # we can also run as headless.

# Locate Isaac Sim assets folder to load sample
from omni.isaac.core.utils.nucleus import get_assets_root_path, is_file
from omni.isaac.core import World
from omni.isaac.core.objects import DynamicCuboid
import numpy as np

usd_path = "test.usd"
# Wait two frames so that stage starts loading

from omni.isaac.core.utils.stage import is_stage_loading

while is_stage_loading():
print("Loading Complete")

from omni.isaac.dynamic_control import _dynamic_control

dc = _dynamic_control.acquire_dynamic_control_interface()
world = dc.get_world()

carter = world.scene.get_object("carter_v1")

for i in range(500):
    position, orientation = carter.get_world_pose()
    linear_velocity = carter.get_linear_velocity()
    # will be shown on terminal
    print("Carter position is : " + str(position))
    print("Carter's orientation is : " + str(orientation))
    print("Carter's linear velocity is : " + str(linear_velocity))
    # we have control over stepping physics and rendering in this workflow
    # things run in sync
    world.step(render=True) # execute one physics step and one rendering step

kit.close() # close Isaac Sim

But apparently, the get_world() method is not present:

Traceback (most recent call last):
  File "C:\Users\gpepp\AppData\Local\ov\pkg\isaac_sim-2023.1.0-hotfix.1\exts\omni.isaac.examples\omni\isaac\examples\user_examples\", line 35, in <module>
    world = dc.get_world()
AttributeError: 'omni.isaac.dynamic_control._dynamic_control.Dynami' object has no attribute 'get_world'

How can I access the World handle then?
Thanks in advance!

Hi @revolverset

Isaac Sim core components, such as World are Python APIs only and therefore are not stored in the USD file. In your case, you need to create a World instance and register the prims in the world’s scene to be able to access them using its API.

Refer to standalone_examples/api/omni.isaac.core/ example for a sample demonstration.