smart mesh project blender code example
Example: smart uv blender
Enter UV Editing
On the right side with your mesh press 'A' to select all
On the UV (Left Side) side press 'F3' and "Type Smart UV Project"
Press OK in the window that pops up
Voila