Insert Row in Child Table of Another Document Using Server Script

Hello all, hope you’re having a great day.
I’m having a problem with my server script and I was hoping if anyone can help.
Context: I want to add child table record in a Projects doctype from another doctype called task assignment.
Case: I want to develop a doctype where the user can add multiple tasks for different projects and on save, tasks are added to the tasks table (custom table) in Project doctype with each project.

Task Assignment Doctype:

Project Doctype Task Child Table (Custom Table)

Server Script so far:

#Create the task list from Task Assignment doctype
tasks_to_add =
for t in doc.tasks:
tasks_to_add.append({‘project’: t.project, ‘project_name’:t.project_name, ‘subject’: t.subject,})

#Add task list to Project doctype
for task in doc.tasks:
project = frappe.get_doc(‘Project’, task.project_name)
project.testing = tasks_to_add
project.save()

It’s showing this error
image

Sorry for the long post, have a nice day!

did you solve /?

Yes I did what’s the problem you’re facing?

Can you please share the code?
Thank you