I have used what @lejedi76 proposed, but the code does not work in the recent versions of QGIS.
In my Windows 10 & QGIS 3.40.11, this worked:
import console
script_path = iface.mainWindow().findChild(console.console.PythonConsole).findChild(console.console_editor.EditorTabWidget).currentWidget().file_path()