Thank you. This pointed me in the right direction.
I also used this for hints https://frappe.io/docs/user/en/guides/reports-and-printing/how-to-make-script-reports