execute_script
Run arbitrary Python code in Isaac Sim for operations not covered by named tools, such as creating Action Graphs, computing IK, or configuring advanced USD properties. Use for custom simulation logic and callbacks.
Instructions
Escape hatch: execute arbitrary Python code in Isaac Sim.
PREFER named tools over this for: reading/setting joints (set_joint_positions, get_joint_positions), inspecting state (get_prim_info, get_physics_state, get_joint_config), stepping simulation (step_simulation), and checking logs (get_isaac_logs).
USE this for: operations no named tool covers, such as creating Action Graphs, computing IK, setting up physics callbacks, or configuring advanced USD properties.
CAUTION: touching an articulation controlled by a running ScriptNode / Action Graph can silently break its control path (no error is raised). While a graph is running, read-only diagnostics (get_prim_info, get_physics_state, get_joint_positions, get_isaac_logs) are safe, but stop_simulation before using execute_script or named write tools on the same articulation.
For persistent controllers (>20 lines), write a .py file and load it with reload_script instead of pasting code here.
Args: code: Python code to execute in the Isaac Sim context. cwd: Optional working directory to add to sys.path before execution.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | ||
| code | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |