I am using SimPy, and I try to simulate a network.
This is my main module:
from SimPy.Simulation import *
import node0
import message0
import network0
reload (message0)
reload (node0)
reload(network0)
initialize()
topology=network0.Network()
activate(topology, topology.operate())
node1=node0.Node(1)
node1.interface.send(destination='node1')
simulate(until=25)
I want an object of class message, which is activated by an object of class node, to interrrupt
class Message(Process):
def arrive(self, destination, myEvent=delay):
self.destination=destination
self.interrupt(topology)
an object of class Network (topology)
.
But I'm getting an error:
NameError: global name 'topology' is not defined
And I don't know how to make an object global. And if I type topology in python shell then it shows me object topology, so why can't message see it?