Cancel JV from another doctype

Hello,

I’ve problem in cancellation of Journal entry.
i’ve created one doctype like credit note and did journal entry on submitting of that doctype using following method and it works perfectly.

JV = frappe.get_doc({
“doctype”: “Journal Entry”,

})

JV.insert()
JV.submit()

But now i want to cancel JV on cancellation of my doctype.
How to do this?