# Keeping track of splines in curve -> splines.get(), but what is the key?

I have a curve and want to check whether a spline already exists.

As other data types, there is a get() method. But what is the key? Since splines.new() takes only one argument (the type), there seems to be no identifier?

My current workaround is to use exception handling and accessing the splines directly using splines[x], but that is kinda ugly.

curve.splines is a list so you can test how long it is -

if len(obj.data.splines) > 0:
print('There is a spline in this curve')


You can treat the points the same -

if len(obj.data.splines[i].bezier_points) > 0:
print('We have a point in this spline')


Depending on what you are doing you could also use a for loop -

for s in obj.data.splines:
print('This only prints if there is at least one spline')