How to use the glyphs Python script to obtain a line segment of the selected glyph with the mouse

How to use the glyphs Python script to obtain a line segment of the selected glyph with the mouse

For example, when I click on the left line segment with the mouse, how can I use a Python script to know which line segment I have selected instead of other lines
屏幕快照 2023-05-16 10.45.39

What do you mean by “line segment”?
You can check if a node is selected. Either by checking node.selected or by node in layer.selection.

Thank you. My problem has been resolved