I been doing research on how to edit PDF using Python and i have found this article: How to Populate Fillable PDF\'s with Python
However there is a problem on
To expand on Sergio's answer above, the following line:
template_pdf.Root.AcroForm.update(pdfrw.PdfDict(NeedAppearances=pdfrw.PdfObject('true')))
Should be put after this line in the example code from OP:
template_pdf = pdfrw.PdfReader(input_pdf_path)