How to shutdown and reinitialize a publisher node in ROS 2

Funny you should mention this python alternative. For a potential use case, I was just using this style of iterative initialisation and shutdown within a single thread to do sros2 access control verification this week. Interesting to know that had I used rclcpp to benchmark my policies rather than rclpy I would have hit this current issue. I also found using the try_shutdown method more forgiving to use should you ever lose track of the state of things like when developing from in an interactive python shell session.