I am currently stucked with the example 6.8.
I already read here in the community, but I still can not make it work.
Here in this image you can see all the screenshots in which I am referring in my request.
I think you are using the wrong command to run the program.
You should use:
rosrun <package_name> <program_name.py>
python <program_name.py> # see below for more info
Also, you get this module not found error for custom message if you have not compiled it properly.
To make sure that the custom message package is properly compiled, run this command
catkin_make --only-pkg-with-deps my_custom_srv_msg_pkg
Once you have executed the above commands, then do the rosrun ... command on the same terminal.
That should fix your problem. Let me know if that does not work.
Why you cannot use python <program_name.py>:
When you have custom messages, you cannot use the python command. That is because the custom message that you have created is neither a python package nor an installed library with python pip.
Therefore, you can only use rosrun command and not python command. Python will NOT detect that import as a library or as a module. Thus you get a python error instead of ROS error.