How to run Python Example from command line?

Hello,

I’m trying to run a Moveit2 Python Example from command line.

I could run it from simulation UI, but having hard time to execute from command line.

Following command is what I tried with Conda, and no-Conda environments.

(isaac) ~/isaac-sim$ python3 /home/jay/isaac-sim/exts/isaacsim.ros2.bridge/isaacsim/ros2/bridge/impl/samples/ros_moveit_sample.py
Traceback (most recent call last):
  File "/home/jay/isaac-sim/exts/isaacsim.ros2.bridge/isaacsim/ros2/bridge/impl/samples/ros_moveit_sample.py", line 22, in <module>
    import omni.appwindow
ModuleNotFoundError: No module named 'omni.appwindow'

~/isaac-sim$ ./python.sh /home/jay/isaac-sim/exts/isaacsim.ros2.bridge/isaacsim/ros2/bridge/impl/samples/ros_moveit_sample.py
Traceback (most recent call last):
  File "/home/jay/isaac-sim/exts/isaacsim.ros2.bridge/isaacsim/ros2/bridge/impl/samples/ros_moveit_sample.py", line 22, in <module>
    import omni.appwindow
ModuleNotFoundError: No module named 'omni.appwindow'
There was an error running python

Is there a way to execute python example solely from command line?

Basically, what I want to achieve is running this from command line (from Hello World Example):

Thank you in advance.

It looks like the ModuleNotFoundError is happening because you’re not running the script in the correct Isaac Sim environment. The modules you’re trying to import are only available when the simulation is launched correctly.

You can find more details in the official documentation: