How do I run an action server and service server simultaneously for the part III of the rosject

Hi,
I am trying to do part III of ROS IN 5 DAYS project. I am unable to run the action server and service server simultaneously. I want to send the current total distance of the robot as feedback with the action server and simultaneously make the robot move using the service server. I also have been unable to send the result of the action server to the client. My client is shown below. Please how can I fix this?

#! /usr/bin/env python
#Client

import rospy
import actionlib
from geometry_msgs.msg import Twist
from sensor_msgs.msg import LaserScan
from nav_msgs.msg import Odometry
from moveInSquare_srv.srv import MoveInSquare, MoveInSquareRequest
from custom_action_pkg.msg import OdomRecordAction,OdomRecordFeedback,OdomRecordResult,OdomRecordGoal


def feedback_callback(feedback):
    print('The total distance covered is '+str(feedback.current_total))

rospy.init_node("turtlebot3_node")
action_server_name = '/record_odom'

client = actionlib.SimpleActionClient(action_server_name, OdomRecordAction)
# waits until the action server is up and running
rospy.loginfo('Waiting for action Server '+action_server_name)
client.wait_for_server()
rospy.loginfo('Action Server Found...'+action_server_name)

# creates a goal to send to the action server
goal = OdomRecordGoal()
client.send_goal(goal, feedback_cb=feedback_callback)
rospy.wait_for_service('/move_bb8_in_square_custom') # Wait for the service
rospy.loginfo("Service /move_bb8_in_square_custom Ready")
turtle_service_client = rospy.ServiceProxy('/move_bb8_in_square_custom', MoveInSquare) # Create the connection to the service
turtle_request_object = MoveInSquareRequest() # Create an object of type ExecTrajRequest
result = turtle_service_client(turtle_request_object) # Send through the connection the path to the trajectory file to be executed 
client.cancel_goal()

print(result) # Print the result type'

client.wait_for_result()
action_result = OdomRecordResult()
rospy.loginfo("Odometer readings: "+str(action_result.list_of_odoms))


Hi,

What kind of error are you getting when you try to launch the client? Have you separated your action and service server in separate files?

Please share more info on what the actual error is. Screenshots of errors always help

I am not getting error messages. The program is working without errors and warnings but It is not behaving the way I want. The goal is to make the robot move and simultaneously record odometry readings but instead the robot records the odometry for a while and then proceeds to move after the odometry readings are no longer recorded(action server stops).