How to draw a line on sagittal view

For the application I am working on, I would like to draw horizontal lines in the sagittal view to mark specific slices that I am interested in. Is there code that can help me achieve this?

I know that in the Markups module I can use a button to draw a markup line, I would like something similar to that.

Thanks in advance!

Markup lines or planes should work well for this. You can place them easily from Python script: add a markups line/plane node to the scene and set control point positions.

For the python script do you mean:

https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Rotate_a_node_around_a_specified_line

There are several relevant examples, see here: https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Markups

thank you very much!