How to apply imported module to active object

by edna   Last Updated April 16, 2019 05:15 AM

I'm trying to import a module (I think that's the right term) and then run it on the active object

In the console I can type:

> from bl_operators.uvcalc_smart_project import main
> main(C, .02, 30, 0.03, True, True)

... and it does smartuvproject on the active object.

In my script I have:

from bl_operators.uvcalc_smart_project import main
bpy.context.view_layer.objects.active
main(C, .02, 30, 0.03, True, True)

... and the console says that "name C is not defined"

I realise I'm missing something pretty basic here, to do with how a function is applied to an object in Blender scripts.

Perhaps the answer is, "go away and learn python." But this stuff is so Blender-specific (maybe even Blender 2.80 specific) that I'm not sure I'm going to find the answer anywhere except here!

Thanks in advance.

Tags : scripting


Related Questions


Updated May 13, 2015 12:44 PM

Updated May 27, 2015 22:06 PM

Updated June 27, 2015 23:06 PM

Updated August 07, 2015 15:06 PM

Updated August 08, 2015 14:06 PM