Rospy not working even though it is imported?
My python script used to run but now does not work. It does not give any errors but only returns a blank terminal. It is also executable. Below is a simplified version of the code with the output. It seems the rospy functions are not working even though rospy is imported. When I wrote the script as an individual script, it worked fine but as soon as I started messing with it so that it could be included in the launch file, it stopped working. Any ideas?
#!/usr/bin/env python
import rospy
import roslib
print "test1"
if __name__ == '__main__':
print "test2"
rospy.loginfo("test3")
rospy.init_node('autodocking', anonymous=True)
OUTPUT:
test1
test2