I have created a simple custom ROS service for ROS Noetic. My import line is:

from fishbot_ros.srv import chess_service, chess_serviceResponse

The file structure is like this:

└── parent
    ├── src
    │   └── chess_node.py
    └── srv
        └── chess_service.srv

The service is generated correctly and is viewable by rossrv show. I have cleaned devel and build subfolders and then executed catkin make.

My CMakeLists.txt has the following sections:

find_package(catkin REQUIRED COMPONENTS


My package.xml has the following:


Please help me understand what I'm doing wrong. I did this for a different project a while ago, and I've done everything the same.


1 Answer 1


Welcome to Robotics Stack Exchange!

If my_ros_pkg and MyService.srv are the name of the ROS package and name of the service file, respectively, please use the following line to import the service:

from my_ros_pkg.srv import MyService, MyServiceRequest, MyServiceResponse
  • $\begingroup$ Hi Ravi, thanks for your comment. Unfortunately, this did not work, I still got the same error as below: from fishbot_ros.srv import chess_service, chess_serviceResponse ModuleNotFoundError: No module named 'fishbot_ros' $\endgroup$ Sep 27, 2023 at 5:06
  • $\begingroup$ I assume fishbot_ros is ROS pkg. You may look at following: 1. CMakeLists.txt and Python Node 2. CMakeLists.txt and Python Node $\endgroup$
    – ravi
    Sep 27, 2023 at 6:16
  • 1
    $\begingroup$ Thank you Ravi. The issue was in my CMakeLists. I had the generate messages section commented out. $\endgroup$ Sep 27, 2023 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.