Pass a class to an InteractiveCompiler?

M

Michael Jard

class grid_object:
def __init__(self,object_class=""):
import random
import code
self.id = random.randrange(1,99999)
self.object_class = object_class
self.label = "grid object: %s %i" % (self.object_class, self.id)
self.vector = [0,0,0]
source = open(grid_config.object_scripts + self.object_class,'r')

x = code.InteractiveConsole({'grid_object':self})

for line in source:
x.push(line)


I'd like to think that was possible?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,204
Messages
2,571,065
Members
47,672
Latest member
svaraho

Latest Threads

Top