Loading a USD stage containing python behavior script with a standalone python script

I have a USD stage with python scripting (behavior script) attached to a prim. The behavior script does some prim movement when certain objects collide on the stage. Now I would like to load that stage in an Isaac Sim standalone python script.

Starting from the omni.isaac.kit/load_stage.py example, first, the python scripting in the USD was not executed. Then I figured out, that I probably have to enable the scripting extension. So I added the following lines to the load_stage.py right after initializing the SimulationApp:

from omni.isaac.core.utils.extensions import enable_extension
enable_extension("omni.kit.scripting")

Now, when I run load_stage.py, I get the following error:

[5.261s] [ext: omni.kit.scripting-104.2.2] startup
2023-08-09 12:08:50 [5,254ms] [Warning] [omni.ext.plugin] [ext: omni.kit.scripting-104.2.2] '/home/clemens/.local/share/ov/pkg/isaac_sim-2022.2.1/extscache/omni.kit.scripting-104.2.2+104.2.lx64.r.cp37/bin' in '[[native.plugin]]' was not found.
2023-08-09 12:08:50 [5,264ms] [Warning] [omni.isaac.core.utils.nucleus] /persistent/app/omniverse/mountedDrives setting not found
2023-08-09 12:08:50 [5,292ms] [Error] [carb.events.python] AttributeError: 'ScriptManager' object has no attribute '_usd_listener'

At:
  /home/clemens/.local/share/ov/pkg/isaac_sim-2022.2.1/extscache/omni.kit.scripting-104.2.2+104.2.lx64.r.cp37/omni/kit/scripting/scripts/script_manager.py(101): _on_stage_detach
  /home/clemens/.local/share/ov/pkg/isaac_sim-2022.2.1/extscache/omni.kit.scripting-104.2.2+104.2.lx64.r.cp37/omni/kit/scripting/scripts/script_manager.py(90): _on_stage_event
  standalone_examples/api/omni.isaac.kit/load_stage.py(53): <module>

Any idea what I am doing wrong?

Hi @clemens.linnhoff1 - The error message you’re seeing suggests that the ‘ScriptManager’ object doesn’t have an attribute ‘_usd_listener’. This could be due to a few reasons:

  1. The version of the Isaac Sim you’re using might not be compatible with the scripting extension you’re trying to enable. Make sure you’re using a version of Isaac Sim that supports the ‘omni.kit.scripting’ extension.
  2. The ‘omni.kit.scripting’ extension might not be properly installed or enabled. You can check if the extension is installed and enabled by going to Window > Extensions in the Isaac Sim UI.
  3. There might be an issue with the way you’re trying to enable the extension in your script. The ‘omni.kit.scripting’ extension is usually enabled by default when you start Isaac Sim, so you might not need to enable it manually in your script.

Thank you for your answer. I am not sure I understand the reasons completely, though. When I start Isaac Sim manually with the launcher, everything works fine. So I don’t understand, why this could be an issue with the extension in the Isaac Sim UI. Since it works, Isaac Sim seems to be compatible and the extension also is enabled.
When I don’t include omni.kit.scripting in the standalone python script, nothing happens with the script. When I include it, at least I get asked at the beginning the typical warning, if I want to proceed with included scripting. But then I get the error messages.