Can someone tell me why setting the font doesn't work for me please?

I have this python script:

I learned most of how to do this by looking at the python displayed in the scripting tab console, so I don’t know if I am doing this right or if there are better ways to do things.

If I go to Control + A - Text, and create a 3D Text and set the font, I get this line printed in the console:

bpy.ops.font.open(filepath=“C:\Windows\Fonts\Palatino Linotype.TTF”, relative_path=True)

I have tried setting the above line in the Python script by commenting out the Verdana font (line 23) and uncommenting line 20 (line shown above), but it doesn’t seem to work.

Two questions:

  1. I saw a way to set the text all at once (not character per character), with something like object.data = “Your Text”, but I haven’t found a way to set the font with this method. Can this be done?

  2. Can someone tell me why the font isn’t working the way it is, or how to set the text in a font specified? Most of the time when I copy code from the console it works when I applied.

Thank you