Python Scripting Beginners Question

Wanting to get started with python programming I tried the following code copied from the blender 2.47 python api site.

   import Blender
   scn = Scene.GetCurrent()
   ob_act = scn.objects.active
   
   # Unselect all
   scn.objects.selected = []
   ob_act.sel = 1
   
   for x in xrange(10):
                   Blender.Object.Duplicate() # Duplicate linked
                   ob_act = scn.objects.active
                   ob_act.LocX += 1
   Blender.Redraw()

after running this in the blender text window with ALT-P I get an error (in the console)

NameError: name ‘Scene’ is not defined
Any ideas what to do?

thx in advance

Add “from Blender import Scene” just after “import Blender” or replace Scene.GetCurrent() with Blender.Scene.GetCurrent() .

I advise you to take a good look at how Python modules work. There is some basic information about the issue at http://effbot.org/zone/import-confusion.htm .

thx alot, will do!