No module named my_custom_srv_msg_pkg.srv

I modified CMakeLists.txt and package.xml. And also I did run source devel/setup.bash.
But when I run “custom_service_server.py”, I keep getting errors.
(my_custom_srv_msg_pkg/MyCustomServiceMessage is created)

ImportErrorTraceback (most recent call last)
in ()
2
3 import rospy
----> 4 from my_custom_srv_msg_pkg.srv import MyCustomServiceMessage, MyCustomServiceMessageResponse # you import the service message python classes
5 # generated from MyCustomServiceMessage.srv.
6

ImportError: No module named my_custom_srv_msg_pkg.srv

Did you make sure to do chmod so that the python file is executable?

Did your messages and services successfully build? If they did, you should be able to find them under devel/include

I have the same issue, I’ve tried twice, including once where I literally copied the solutions. Please help!

All the build and message generation dependencies are correctly defined in package.xml and CMakeLists.txt? Have you tried deleting devel and build folders and building it again?

1 Like

Thank you! After I delete devel and build folder and build it. It works! Thank you!!

1 Like