You can follow the example code here and simply add a second subscription like so:
import rospy
from std_msgs.msg import String
def callback1(data):
rospy.loginfo("Callback1 heard %s",data.data)
def callback2(data):
rospy.loginfo("Callback2 heard %s",data.data)
def listener():
rospy.init_node('node_name')
rospy.Subscriber("chatter1", String, callback1)
rospy.Subscriber("chatter2", String, callback2)
# spin() simply keeps python from exiting until this node is stopped
rospy.spin()
ROS Python nodes are inherently multi-threaded. When you get each callback, it will be in a separate thread. So this is an event-driven model.
Note that this behavior is different than the default behavior for ROS C nodes which are inherently single threaded unless you specifically make them multi-threaded.