|
Hi William,
Thanks for your reply. I was trying that but couldn't get it to work at first (had never used the types module) but got there in the end!
My code looks like this:
with onto:
class Entity(Thing):
pass
for x in onto.classes():
if x._name == "laptop":
NewClass = type(x._name, (Entity,), {"namespace" : onto})
newLaptop = NewClass(name = "laptop5", hasModel="toshiba")
print(newLaptop)
|