I am new to use ROS. I use Ros2 Humble on Ubuntu 22.04. I need to import some python codes/modules from different nested folders (or nested nested folders) to a Ros2 python node. The Ros2 node (demo_in_ros.py) is located in src folder of my Ros package. I have all other python modules in src folder as well. I have imported all python modules to the Ros2 node (demo_in_ros.py) using the python import function (example: from utils import common_utils). The structure of my Ros2 package is below:
ros2demo_ws
|src
|dl_demo
|dl_demo
|demo_in_ros.py
|utils
|common_utils.py
I have successfully built the package using colcon build. After running ros2 run dl_demo pub_sub, I get this error:
from utils import common_utils
ModuleNotFoundError: No module named 'utils'
How can I solve this issue?
I appreciate any help in advance.
Thanks,
Abbas