How to add new row in child table using Python

Hello Every One,
I have write js script for add new row in child table but i need to add new row in child table using python . please help me.

frappe.ui.form.on(“Salary Slip”, “validate”, function(frm) {
deduction_amount = 500;
var row = frappe.model.add_child(cur_frm.doc, “Salary Slip”, “deductions”);
row.salary_component = “Attendance Violation”;
row.amount = Math.round(deduction_amount);


Try frm.doc instead of cur_frm.doc
Any error on console log?If yes please share the screenshots

@rohit_w Thank you for reply ,
Sir actually i need to write this script in python .

Python code

def validate(self):
	deduction_amount = 500;
	row = self.append('deductions', {})
	row.salary_component = “Attendance Violation”
	row.amount = Math.round(deduction_amount)

@rohit_w Thank you sir