How to Add child to an existing document from a different document?

Hi Everyone,
How can i add a new child to an existing document with data coming from a different document?
I have posted a problem earlier, It is regarding saving a new document with children. I was able to find a solution by using frappe.db.commit() . The second part of that code is that it will append the child to an existing document. so I use:

Still it did not save or append the children to the parent doc. I also tried using
and it is still not saving.

No error was displayed.
I also used msgprint to check the if block if it has been executed.

Share the full code snippet you are using to add the children.

This should work:

doc = frappe.get_doc('DocType', 'name')
doc.append('child', {
  'key': value
1 Like

Yes, I have use but it did not work for me. Im also wondering why.

Hi! @jrubins did you find the solution. I am also facing the same issue