ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You've named your script random, which overlaps with the system python module of the same name.

When rospy attempts to import random, it instead imports you script, and causes your code to run before the definition of rospy is complete.

You should name your script something else that doesn't overlap with the system python modules.