Access to an actuator of another controller from a Python script

Hello, just two quick questions:

  1. Is it possibible to access to an actuator of another controller of the same object from a python script? I mean, from a Python script I can always access to the CurrentController (the one where the Python script is) and to all the actuators directly linked, but how can I access to another controller/actuator?

It would be nice to have a method like object.getController(name) to use like this…
own=GameLogic.getCurrentController().getOwner()
obj=own.getController(“cont”).getActuator(“act”).getLastCreatedObject()

  1. Is it possible to use the EditObject::AddObject actuator with an infinite time to live? The maximum I can set is 2000 which is too short and it’s quite a silly limitation in my opinion…

1.) I don’t think you can do that. As you probably know, you can change the property values of another object. You could then hook that objects controller to a property sensor and actuator. Works the same way, but a few more steps.

2.) If you leave the Add object actuator blank, the created object should be infinite.(it won’t disappear).

  1. The fact is that I need to invoke the getLastCreatedObject() method of the EditObject::AddObject actuator in order to obtain a handle to the last added object, but I need to do this in a separate script…

Maybe I could activate the AddObject actuator in a script with addActiveActuator, call the getLastCreatedObject method in the same script, and save the handle to the object in a property (don’t know if it’s possible…?..) and then access the handle from another script later… but even if this were possible, the AddObject actuator would fire twice, in the middle of the script and at the end of the script, am I right? and there would be no way to be ensure the object is added just once…

sudo,

you can store reference to actuator in global variable (example: GameLogic.myActuator) and then you can access it from all scripts.

But generally, need for this kind of access is syndrome of bad design. I suggest you to redesign involved scripts…