# Lifecycle Nodes in Python

**URL:** <https://discourse.openrobotics.org/t/lifecycle-nodes-in-python/14547>\
**Category:** ROS General\
**Created:** [June 8, 2020, 4:24pm UTC](https://discourse.openrobotics.org/t/lifecycle-nodes-in-python/14547 "2020-06-08T16:24:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kam\_mlabs](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@kam\_mlabs](https://discourse.openrobotics.org/u/kam_mlabs)\
**Post date:** [June 8, 2020, 4:24pm UTC](https://discourse.openrobotics.org/t/lifecycle-nodes-in-python/14547/1 "2020-06-08T16:24:31Z")

</div>

Hey there!

We develop in Python, and we would like to be able to use the functionality of lifecycle nodes in Python.

Is there an existing ROS2 roadmap for lifecycle nodes in Python, and what are people’s thoughts on the best way to get this working in Python (bindings, etc.)?

---

<div class="post-metadata">

**Author:** ![karsten](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/karsten/32/483_2.png) [@karsten](https://discourse.openrobotics.org/u/karsten)\
**Post date:** [June 8, 2020, 6:31pm UTC](https://discourse.openrobotics.org/t/lifecycle-nodes-in-python/14547/2 "2020-06-08T18:31:28Z")

</div>

At the time of development, `rclpy` wasn’t in a state which easily allowed us to integrate lifecycle nodes in Python. That’s why we have it only available in C++ as for now.

We anticipated however, that lifecycles are also important to have in Python, so we tried to have as much functionality covered in `rcl`, so that `rclpy` really only has to wrap/implement as little as needed.  
That is, the state machine with its transitions, as well as a basic communication interface for transition events and services are established within `rcl`. A high level language really only has to bind callbacks to these services and provide boilerplate to change transitions either via API or service callbacks.

I am not aware of any roadmap specifically designed for Python and Lifecycle nodes, but it shouldn’t be too hard to replicate a lifecycle node. You might want to have a look at what’s [implemented in C++](https://github.com/ros2/rclcpp/blob/master/rclcpp_lifecycle/src/lifecycle_node_interface_impl.hpp), which uses the functionality provided by `rcl`, to judge how much work it’ll be in Python.

---

<div class="post-metadata">

**Author:** ![stpfi](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/stpfi/32/15592_2.png) [@stpfi](https://discourse.openrobotics.org/u/stpfi)\
**Post date:** [December 20, 2022, 10:17am UTC](https://discourse.openrobotics.org/t/lifecycle-nodes-in-python/14547/3 "2022-12-20T10:17:43Z")

</div>

I found this repository, but have not been able to test the code yet:

[https://github.com/wesleysliao/ros2\_lifecycle\_py](https://github.com/wesleysliao/ros2_lifecycle_py)

---

<div class="post-metadata">

**Author:** ![tnajjar](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/tnajjar/32/8137_2.png) [@tnajjar](https://discourse.openrobotics.org/u/tnajjar)\
**Post date:** [December 20, 2022, 11:32am UTC](https://discourse.openrobotics.org/t/lifecycle-nodes-in-python/14547/4 "2022-12-20T11:32:52Z")

</div>

From a quick look, looks like it was implemented here: [Implement managed nodes by ivanpauno · Pull Request #865 · ros2/rclpy · GitHub](https://github.com/ros2/rclpy/pull/865)  
I’ve been meaning to try it out.

---

<div class="post-metadata">

**Author:** ![tomoyafujita](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/tomoyafujita/32/6097_2.png) [@tomoyafujita](https://discourse.openrobotics.org/u/tomoyafujita)\
**Post date:** [December 20, 2022, 6:49pm UTC](https://discourse.openrobotics.org/t/lifecycle-nodes-in-python/14547/5 "2022-12-20T18:49:43Z")

</div>

As @tnajjar mentioned on previous comment, `Managed Node` of `rclpy` is supported with Rolling and Humble. There is also demo for `Managed Node` of `rclpy`, hope this could be helpful.

> **[demos/lifecycle\_py at rolling · ros2/demos](https://github.com/ros2/demos/tree/rolling/lifecycle_py)**
>
> Contribute to ros2/demos development by creating an account on GitHub.
