FYI: I added ForEach/ForLoop actions to do exactly this. You can use it in XML/YAML, so there’s no need to use Python/OpaqueFunction for this (at least as of Kilted). See: Requesting feedback: new for-loop action for ROS 2 launch files to repeat entities - #5 by christophebedard.
(I don’t mean to derail the discussion, but I thought it was worth spreading the news about new relevant features.)