How to debug a scheduled task?

Gentlemen,

has anyone experience in debugging a scheduled task in Visual Studio Code? There is nice description here (VSCode Debugging for Frappe Python · frappe/erpnext Wiki · GitHub), but this only works for code executed under the web-process (controllers, whitelisted functions).

I even tried to execute the task from the “Scheduled Job Type” view, but breakpoints were ignored.

I can splatter the code of my scheduled task with print() and then do “bench execute”, but this is not very refined.

Is there a way to start a scheduled task in Visual Studio Code so it may be debugged?

I solved this problem (yay, go me!):
https://discuss.frappe.io/t/how-to-add-debugger-in-frappe/53623/8

This way you can use “bench execute” to start anything you want, and still use the debugger