# A new tool to create ros2 package with executables, c++ and Python node in one package

**URL:** <https://discourse.openrobotics.org/t/a-new-tool-to-create-ros2-package-with-executables-c-and-python-node-in-one-package/57089>\
**Category:** ROS General\
**Tags:** ros2\
**Created:** [July 31, 2026, 1:29pm UTC](https://discourse.openrobotics.org/t/a-new-tool-to-create-ros2-package-with-executables-c-and-python-node-in-one-package/57089 "2026-07-31T13:29:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yjphhw](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/yjphhw/32/32542_2.png) [@yjphhw](https://discourse.openrobotics.org/u/yjphhw)\
**Post date:** [July 31, 2026, 1:29pm UTC](https://discourse.openrobotics.org/t/a-new-tool-to-create-ros2-package-with-executables-c-and-python-node-in-one-package/57089/1 "2026-07-31T13:29:54Z")

</div>

site: [GitHub - yjphhw/ros2\_pkg\_create: A utility script for generating ROS 2 package templates that support both C++ and Python nodes, simplifying mixed-language development within a single package. · GitHub](https://github.com/yjphhw/ros2_pkg_create)

useage is very easy, just download the ros2\_pkg\_create.py and put in a workspace(direction),

and run 🙂

```auto
python3 ros2_pkg_create <package_name>

```

such as create demo\_pkg:

```auto
python3 ros2_pkg_create demo_pkg

```

output is :

🚀 正在生成混合功能包: my\_pkg  
✅ 已创建: src/my\_pkg/CMakeLists.txt  
✅ 已创建: src/my\_pkg/package.xml  
✅ 已创建: src/my\_pkg/setup.cfg  
✅ 已创建: src/my\_pkg/LICENSE  
✅ 已创建: src/my\_pkg/src/hello\_world.cpp  
✅ 已创建目录: src/my\_pkg/include/my\_pkg/  
✅ 已创建: src/my\_pkg/src/script\_node.py  
✅ 已创建: src/my\_pkg/my\_pkg/ **init**.py  
✅ 已创建: src/my\_pkg/my\_pkg/py\_node.py

🎉 功能包 [my\_pkg] 生成完毕！  
💡 提示: 记得在 CMakeLists.txt 中根据需要补充依赖项。

按照以下步骤进行下一步操作:  
💡 1.编译功能包: colcon build --symlink-install --packages-select my\_pkg  
💡 2.安装功能包: source install/setup.bash  
🚀 3.测试可执行程序: hello\_world  
🚀 4.测试 C++节点: ros2 run my\_pkg hello\_world  
🚀 5.测试 Python 节点: ros2 run my\_pkg script\_node  
🚀 6.测试 Python 模块: ros2 run my\_pkg my\_py\_node

follow the instructions in output, you can build and run package in one minute.

you will get a ros2 pkg template, you can easily add C++ , Python and normal executable.

welcom to Star the project: [GitHub - yjphhw/ros2\_pkg\_create: A utility script for generating ROS 2 package templates that support both C++ and Python nodes, simplifying mixed-language development within a single package. · GitHub](https://github.com/yjphhw/ros2_pkg_create)
