load multiple objects

hello all, i have a question. i´m loading multiple objects with the command “for i in range(15):”, but i want to show one model each handlerEvent. take a look:

  for i in range (4):
      self.bola[i] = loader.loadModelCopy("models/smiley")  
      self.bola[i].setPos(1*i,0,1)
      i = i + 1

  self.accept('space', self.new)

def new(self):
   self.bola[i].reparentTo(render)
   i = i + 1
--SNIP--

that is it, but it´s not working. someone have a tip?

your ‘i’ variable in new() doesn’t have a large enough scope. It is destroyed once new() completes. You need something like:

self.bola[self.i].reparentTo(render)
self.i += 1