add object by property name

hello.

Id like to add an object with the same name as a property. Such as:


owner["add"] = variable 
if key[bge.events.RKEY]==1:
     scene.addObject("owner["add"] ", "inv", 0)
 

Doesnt Work

Assume all python is correct
Is there another step I have to do to make it workable.

Any help appreciated

If I understand you correctly, then all you need to do is take the quotes off of owner[“add”]. They were probably giving you a syntax error.

scene.addObject(owner["add"], "inv", 0)

That should work.