DoesNotExistError in background job triggered in after_insert

We have one DocType call “Wechat Send Doc”, which will send Wechat App notify message after user created one instance of this DocType.
def after_insert(self): frappe.enqueue('wechat.wechat.doctype.wechat_send_doc.wechat_send_doc.wechat_send', doc_name=self.name)

def wechat_send(doc_name: doc = frappe.get_doc('Wechat Send Doc', doc_name) return doc.wechat_send()

Then we got following exception:
DoesNotExistError: Wechat Send Doc MSG000000022 not found

Did u try after_save?

Is it one document event? I did not found it from frappe/model/document.py

Have a look at https://frappe.github.io/frappe/user/en/guides/basics/hooks

I am working with develop branch. I have defined the after_save in WechatSendDoc class, it is not be called. I have also tried with hooks.py:
doc_events = { "Wechat Send Doc": { "after_save": "wechat.wechat.doctype.wechat_send_doc.wechat_send_doc.after_save", } }
No lucky :frowning:

doc_events methods must be defined outside the class

For having doc_events, I defined the after_save outside. For testing, I have two methods called after_save in wechat_send_doc.py. One is after_save(self) in class, another is after_save(doc, method): outside

And there is no method/module not found output in console for sure, which means I have proper/valid hook method.

I have also put debug print in those after_save methods, and there is no output.