ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
If you are trying to import a python module for a different package you need 2 things (lets assume the file you want to import is in a package called utils).
1) On the manifest.xml of the package where you are trying to import to, you need to include a <depend package="utils"/> 2) The python module that you want to import must be in folder /src within the utils package (not /scripts), as the /src folder is automatically exported to PYTHONPATH.
This second step took me quite a while to figure out. It will not work if your python files are in a folder other than src. If you do want to have the python files in a folder other than /src then you need to add an <export> command to the manifest.xml in the utils package.
You can of course just add an export PYTHONPATH command to your .bashrc file, but that makes things messy of you are building code on one machine then migrating it to another (ie your robot).