Check if a mesh has an UV Channel in Python I want to create a script that checks if the selected mesh has an UV Channel, if not it does a Smart UV Project.
This will do the trick:

import bpy

# Check if active object has any UV layers
if not len( bpy.context.object.data.uv_layers ):
    bpy.ops.uv.smart_project() # Perform smart UV projection