how to unwrap simple object

how can you unwrap a simple plane as the selected or the active object
or a UV sphere ?

with ops or with bpy struct commands

thanks

in edit mode bpy.ops.uv.unwarp()

i tried to select the active object and then do an umwrap

but get context error ?

how can i correct this

bpy.context.scene.objects.active = bpy.context.scene.objects[“Cube”]
bpy.ops.uv.unwrap()

thanks

need to be in edit mode before doing it

bpy.ops.object.editmode_toggle()

bpy.ops.uv.unwrap()

salutations