How to insert a uvsphere using python

Does anybody know how to insert a uv sphere/cube… into blender from python?
Thanks for your help

I am not sure there’s an “easy” way to do this. AFAIK you can (with a trick) emulate keypresses, but not get the focus of the menu. Your pbest bet would be to replicate the blender functions that add these meshes to the scene. Even then you have two approaches: add static “pre recorded” meshes, or add parametric meshes. Cube is easy. For the segmented sphere you just need to make sure that x+y+z = radius, and you can build them working with angles. From there on gets progressively more difficult.

I wrote a module for this : http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_modelmshapes.htm

Good.
Just a little question or curiousity. Why did you builded it in class? a function could do the job well…