I'm not sure it's the ideal approach for ros2 bag, but you can launch an ExecuteProcess for any ros2 CLI.
I'm not sure it's the ideal approach for ros2 bagrosbag2, but you can launch an ExecuteProcess for any ros2 CLI.