RPlidar Sensor not working in Python when created inside isaac sim action graph

Hi, I have a Rplidar S2E sensor that I added inside Isaac Sim and attached the Action Graph according to the tutorial given herehttps://docs.omniverse.nvidia.com/isaacsim/latest/ros2_tutorials/tutorial_ros2_rtx_lidar.html. The sensor works when I press play and I can see the data being published on the scan topic. However, when I tried to play the simulation from python script, the Lidar data being published to the scan topic is zeros. My question is do I need to add something in my python script to make the sensor publish something? I have already enabled the ros2 bridge in the script.