Getting the last vertex in a line created from extruded a vertice

Hi I have a line created from extruded vertices and I try to select the last vertice in the line programmatically. any help would be appreciated.

Depending on what data you want from the vertex the following should help you.
edited to show access to different curve type point data.

import bpy

ob = bpy.context.object
if ob.type == 'MESH':
    # list of verts
    all_verts =
    # single vert still in list
    last_vert = all_verts[-1:]
    # single vert no list
    last_vert = all_verts[-1:][0]
    # coordinates
if ob.type == 'CURVE':
    # a single curve object can hold multiple curves
    # we will focus on 1st curve
    spline =[0]
    if spline.type == 'BEZIER':
        # points are stored slightly differently in different curve types
        points = spline.bezier_points
        last_vert = points[-1:][0]
    if spline.type == 'POLY':
        points = spline.points
        last_vert = points[-1:][0]

1 Like

Possible solution.

import bpy

# mesh active
obj =

# l_all = list with all vertices of the mesh
l_all =[obj].vertices

# select the last vertex
l_all[-1].select = True

# Move l_all[-1]
l_all[-1].co.x += 0.1