How to unwrap a mesh from view in python. blender 2.8 Hy All
Im a blender noob trying to get a font texturised in blender.
Thats how i plan to do it:

create the font (is a curve)
convert the curve to mesh
uv_unwrap the mesh from view (i need just plain unwrapping, since its 2d)
add material
render

So far all works except the unwrap which leaves me with a horridly distorted mapping of the image.
myFontCurve = bpy.data.curves.new(type=&quot;FONT&quot;,name=&quot;font&quot;)
myFontOb = bpy.data.objects.new(&quot;myFontOb&quot;,myFontCurve)
  
myFontOb.data.body = &quot;my text&quot;
    
bpy.context.collection.objects.link(myFontOb)    
    
# Set Material
mat = bpy.data.materials['Material'] #Material Nodes Settings are done in gui
# We use nodes here... 
mat.use_nodes = True
backgroundfile = &quot;pathtoaffile.jpg&quot;
mat.node_tree.nodes[&quot;ColorTexture&quot;].image = bpy.data.images.load(backgroundfile)
    
# Assign Material to Object                                           
if myFontOb.data.materials:
    myFontOb.data.materials[0] = mat
else:
    myFontOb.data.materials.append(mat)
    
bpy.data.objects[&quot;myFontOb&quot;].uv.project_from_view(orthographic=False, correct_aspect=True, clip_to_bounds=False, scale_to_bounds=False)
       
# Render the letter
output = &quot;path to file.jpg&quot;
bpy.context.scene.render.filepath = output
bpy.ops.render.render(write_still = True) 

My attempt to do so with unwrap_from_view fail with &quot;'Object' object has no attribute 'uv'&quot;.
Like i said, im a rookie and help would  be very much appreciated.
If somebody could point me in the right direction, that would be awesome.
Thanks you
Use the mesh coords
The issue with your script is you are mixing objects and operators.
Here is the autocomplete of the project from view operator in the console.
&gt;&gt;&gt; bpy.ops.uv.project_from_view(
project_from_view()
bpy.ops.uv.project_from_view(orthographic=False, camera_bounds=True, correct_aspect=True, clip_to_bounds=False, scale_to_bounds=False)
Project the UV vertices of the mesh as seen in current 3D view

Trying with C.object.uv. will throw same error as in question since an object has no property uv.
At issue with operators that use the view is they are designed to be run from within that view (it has context) via a button or menu item. Using in script will often require passing an override context or other dicking around, however for this would simply write the UV directly from the mesh coordinates.
To convert the context object to a mesh
&gt;&gt;&gt; bpy.ops.object.convert(
convert()
bpy.ops.object.convert(target='MESH', keep_original=False, angle=1.22173, thickness=5, seams=False, faces=True, offset=0.01)
Convert selected objects to another type

So with a curve object as context object
&gt;&gt;&gt; bpy.ops.object.convert(target='MESH')
{'FINISHED'}

eg this can be called directly after adding the font object and setting its body text.
Using the mesh coordinates
The UV operator template in Text Editor &gt; Templates &gt; Python &gt; Operator UV  adds a UV that is pretty much an orthogonal projection from above as it uses the x and y vertex coordinate as UV.
Here I've tweaked it to normalize the U and V to 0, 1 range.  To have same aspect would scale by the minimum of the X and Y range.

import bpy
import bmesh
import numpy as np
from mathutils import Matrix

def main(obj):
    me = obj.data
    bm = bmesh.new()
    bm.from_mesh(me)
    #bm = bmesh.from_edit_mesh(me)
    x, y, z = np.array([v.co for v in bm.verts]).T
    S = Matrix.Diagonal(
        ( 1 / (x.max() - x.min()),
          1 / (y.max() - y.min()))
          )
    uv_layer = bm.loops.layers.uv.verify()
    
    # adjust uv coordinates
    for face in bm.faces:
        for loop in face.loops:
            loop_uv = loop[uv_layer]
            # use xy position of the vertex as a uv coordinate
            loop_uv.uv = S @ loop.vert.co.xy

    bm.to_mesh(me)
    me.update()

# Test call    
main(bpy.context.object)