ModuleNotFoundError: No module named 'wall_follower_interfaces.actions'

Hello, I am working on the ROS2 Basics in 5 Days (Python) course. My project fails with a ModuleNotFoundError: No module named ‘wall_follower_interfaces.actions’. I believe that my configuration files (package.xml, CMakeLists.txt), interface definitions, and folder structures are correct. The colcon build command completes successfully, but according to Gemini, it does not generate the Python interface files in the install directory. Can someone guide me through solving this issue?
Thanks

Hi @aaronjerry02, welcome to the community!

This happens when the main node can’t find a custom interface.

  • Is your node in the same package wall_follower_interfaces? I doubt it.
  • If it isn’t, then try and compile only the interfaces package with: cd ~/ros2_ws && colcon build --packages-select wall_follower_interfaces. If your configuration is correct, then it can be found after sourcing your workspace with source ~/ros2_ws/install/setup.bash
  • At this point, you should be able to run your main node with no issues

Hi @rodrigo55,

My node is in a separate package (wall_follower) from the interfaces (wall_follower_interfaces), so your first point is correct.

I tried your suggestion to build only the interfaces package first (colcon build --packages-select wall_follower_interfaces), but unfortunately, I am still getting the exact same ModuleNotFoundError when I try to launch my node

Error recieved when i try to run the action server alone:
user:~/ros2_ws$ ros2 launch wall_follower start_odom_recorder.launch.py
[INFO] [launch]: All log files can be found below /home/user/.ros/log/2025-08-13-15-02-29-427675-2_xterm-6272
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [odom_recorder_executable-1]: process started with pid [6274]
[odom_recorder_executable-1] Traceback (most recent call last):
[odom_recorder_executable-1] File “/home/user/ros2_ws/install/wall_follower/lib/wall_follower/odom_recorder_executable”, line 33, in
[odom_recorder_executable-1] sys.exit(load_entry_point(‘wall-follower==0.0.0’, ‘console_scripts’, ‘odom_recorder_executable’)())
[odom_recorder_executable-1] File “/home/user/ros2_ws/install/wall_follower/lib/wall_follower/odom_recorder_executable”, line 25, in importlib_load_entry_point
[odom_recorder_executable-1] return next(matches).load()
[odom_recorder_executable-1] File “/usr/lib/python3.8/importlib/metadata.py”, line 77, in load
[odom_recorder_executable-1] module = import_module(match.group(‘module’))
[odom_recorder_executable-1] File “/usr/lib/python3.8/importlib/init.py”, line 127, in import_module
[odom_recorder_executable-1] return _bootstrap._gcd_import(name[level:], package, level)
[odom_recorder_executable-1] File “”, line 1014, in _gcd_import
[odom_recorder_executable-1] File “”, line 991, in _find_and_load
[odom_recorder_executable-1] File “”, line 975, in _find_and_load_unlocked
[odom_recorder_executable-1] File “”, line 671, in _load_unlocked
[odom_recorder_executable-1] File “”, line 848, in exec_module
[odom_recorder_executable-1] File “”, line 219, in _call_with_frames_removed
[odom_recorder_executable-1] File “/home/user/ros2_ws/install/wall_follower/lib/python3.8/site-packages/wall_follower/odom_recorder.py”, line 9, in
[odom_recorder_executable-1] from wall_follower_interfaces.actions import OdomRecord
[odom_recorder_executable-1] ModuleNotFoundError: No module named ‘wall_follower_interfaces.actions’
[ERROR] [odom_recorder_executable-1]: process has died [pid 6274, exit code 1, cmd ‘/home/user/ros2_ws/install/wall_follower/lib/wall_follower/odom_recorder_executable --ros-args -r __node:=odometer_recorder_node’].

Did you forget to source the workspace before running ros2 launch wall_follower start_odom_recorder.launch.py

You need to run the source command on every terminal where you intend to work with the action messages.

Also, you should add wall_follower_interfaces to the dependencies of wall_follower so that wall_follower_interfaces gets built first when you run colcon build.

Just to be sure, I would start over:

cd ~/ros2_ws
rm -rf build/ install/ log/
colcon build
source install/setup.bash

If you still get the errors, it means you custom package was not built, and its setup needs to be reviewed.

Hi @bayodesegun ,

Thank you so much for your help with this issue.

I have identified the final error, and it is now functioning properly. It turns out the problem was a typo in my Python code. My import statement was from wall_follower_interfaces.actions import OdomRecord (with a plural ‘actions’), when it should have been from wall_follower_interfaces.action import OdomRecord (with a singular ‘action’).

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.