ModuleNotFoundError while importing custom msgs

Facing ModuleNotFoundError while importing the custom msgs in exercise 4.3 of ROS basics with python in 5days on subscribers topic

Hi, welcome to the community!

I assume the issue is that the package that you made is not correctly built or sourced.

To chech this, you use roscd (with the correct package name)

roscd custom_msgs_pkg

If it doesn’t return anything, it wasn’t built/sourced properly:

cd ~/catkin_ws
catkin_make
source devel/setup.bash
rospack profile

hi, thanks for assisting!

i am still facing the issue, even after tried the things you suggested i could not able to identify the root cause of the issue.

it shows modulenotfounderror and cannot import while using the same command from different locations. I have attached the terminal output below.

Can you try creating files as indicated in the exercise, instead of trying to run Python statements from the command line (that’s not guaranteed to work)?

Please go through the exercise, carefully creating and modifying the required files.

Yes, i have tried creating all the files with proper modifications. Also i have tried creating them as exactly they have provided in the exercise solution that too not working.

Just to show case the error i am facing i have shared the image running the python command.

In that case, please refer to this post for further help. It looks like a sourcing problem.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.