I have a Node2D, which contains a Panel, and I want to know when it is clicked.
do you want it on Node2D node?
do I want what on Node2D node?
Controls have a _gui_input (_input_event on 2.x) callback you can use to detect events on them, also as signal to pass to another node.
How do I do it so that it is called while it is pressed (not only the frame it is pressed, but all frames it is actually pressed)?
Events trigger only when happen, and "hold" is not an event, but you can use the "press" to enable processing in _process
Turn that variable false on the release event.