What's the best way to import large python modules into a ROS package? - import errors python ROS
I want to include a large python module (Yolov7 - https://github.com/WongKinYiu/yolov7.git) into my already existing ROS package. The large python module consists of many files which depend on each other. I want this to be included and available for use in my main program scripts/main.py, which runs as a ROS node. This means I only want access to the functions, not create an entire new node itself.
File structure: https://imgur.com/a/THP5WvP
PROBLEM: Files in yolov7 including other files in yolov7 need to have the path name package.yolov7.filename, while the whole module is actually written on the form: **from filename import ...**
How can I make sure files in yolov7 actually can import other files in yolov7 without having to add the extra path to every import?
Example: instead of having to write: from package.yolov7.utils.datasets import letterbox
I want to be able to have: from utils.datasets import letterbox
I have tried editing CMakeLists.txt, setup.py, and package.xml, but for now they are unchanged in regards to yolov7.
I'm using ROS Noetic, running Ubuntu 5.4.123.
Asked by RosBoss on 2022-08-02 08:42:49 UTC
Comments