def main(): rospy.init_node("listener") sub = rospy.Subscriber("/chatter_topic", String, callback) rospy.spin()