ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

python directory import issue on ROS

asked 2017-08-09 02:51:27 -0500

apanda gravatar image

updated 2017-08-09 02:53:18 -0500

hi all, My ros_workspace directory is like this:

ros_workspace --> src--> package1(src, msg, script((folder1-->, ( folder2-->

I want import "" from "", how should i write ? I tried "import package1.script.folder2.abc2" from "", it is so long for the path, also I use catkin_make under ros_workspace build, the error show "ImportError: No module named scripts.folder2" How should i import the from ? please don't say "put and together", this is just a example, I have too many python files, so i need category them to several folder. thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-08-09 03:07:25 -0500

naveedhd gravatar image

You would need to write and include catkin_python_setup() in CMakeLists as described in Section 1.2 here. This would add your packages to PYTHONPATH when you source the workspace.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-08-09 02:51:27 -0500

Seen: 555 times

Last updated: Aug 09 '17