Class not able to find a dictionary in World instance

Ok, I have changed my code to involve classes now. I have a penguin class which contains the collision traverser, the handler, and accepts the collision Entry events. Here’s the code for that:

        # create a collision segment coming out of the penguin's front
        self.penguinSeg = CollisionSegment(0,0,1,0,10,1)
        self.penguinSegNodePath = self.model.attachNewNode(CollisionNode('penguinColSegNode') )

        # set up collision traverser
        self.traverser = CollisionTraverser('penguinTraverser')
        base.cTrav = self.traverser

        # initialize collision handler
	self.collisionHandler = CollisionHandlerEvent()
        # check if the from object hit any node

        for i in range (1, 500):
            self.accept('self.penguinColSegNode-again-rock'+str(i),[i].collide, [[i], w])
            self.accept('self.penguinColSegNode-again-spike'+str(i), w.spikes[i].collide, [[i], w])

        # add the collision node path and the handler to the traverser
        self.traverser.addCollider(self.penguinSegNodePath, self.collisionHandler)

Basically i have a dictionary of all the rocks and spikes in my level, with the keys being ints from 1-500 and the values being the rock/spike object itself (or a pointer to the object if you like).

Panda doesnt seem to like these accept statements. It says "World instance has no attribute ‘rocks’ ". But I passed the world class to the penguin class when I declared the penguin, as follows:

self.penguin = Penguin(self.penguinModel, self)

and I look for the world instance in my init method in the penduin class as follows:

class Penguin(DirectObject):

    def __init__(self, model, w):

So I’m sitting here looking at the following 2 lines of code in the init function of my world class: = {}
self.spikes = {}

My question is: Why is the penguin class not recognizing the and w.spikes dictionaries when I pass the world instance w to the penguin class init function?

lol, I’m an idiot.

Please disregard this whole post. I tried to load the penguin model before I declared the dictionaries.