0
$\begingroup$

Rosanswers logo

Hi everyone,

I'm quite new in programming using Python, but I need to use it in order to call some libraries in ROS I've downloaded from Github. The thing is that I need to call a msg I've created (it works in ROS using C++), but when I try to load it in a Python script using from my_pkg.msg import my_msg it just exit because of the following error:

ImportError: No module named msg

I've followed the instruction you can find in this tutorial 1 and I've read a lot of topics, but I still cannot solve it. The thing is that for what I can understand from other topics and user answer, Python makes itself a mess and cannot find the module. There's something I might be forgeting. Any idea?


Originally posted by drodgu on ROS Answers with karma: 59 on 2019-10-15

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I guess your custom messages are in the package named my_pkg. Add that package in your package.xml so the messages are built before this package is to be used:

<depend>my_pkg</depend>

If you have already done so, you can also check this question.


Originally posted by pavel92 with karma: 1655 on 2019-10-15

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by drodgu on 2019-10-15:
I'm sorry I answer you so late. I've tried but failed. The compiler says that you cannot load that package on my_pkg or something like that. Finally I've decided to create a new package with al my messages and use that package messages instead.

Thank you very much for your quick answer!

$\endgroup$

Your Answer

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