New python API problem

Hi

I’ve a code :
self.scene.objects[objName].Text = val

It generates warning:
Method obt.attr = val is deprecated…

Thus I changed it to:
self.scene[‘objects’][objName].Text = val

Then I get error:
TypeError "KX_Scene’ object is unsubscriptable

How to resolve it?

Try it like this:


obj = GameLogic.getCurrentScene().objects["OBobjName"]
obj["Text"] = val

Thx Social, now it works nice.