How to get another object's property and change it?

So the Object A has a script that wants to change a property in Object B. How can I do that?

that’s too abstract to understand… what you mean by “Object A has a script”?

A has a sensor that is connected to a python script that does actions to other objects like moving them around and stuff. I want that script to reach out for the properties in the B object. Also I’d like to refer to properties in another scene’s objects.

ok,try this:

add a property to object A , connect it to the property of B you want to reach.

Connecting properties:

  • Send a message to object B from object A ,when there is a change in property of object A.
  • So now when object B gets that message ,it activates a property actuator which will add / subtract / assign a value to desired property.

Showing you connections for more help:

logic bricks for object A:

[TABLE=“class: grid, width: 500”]

mouse click

and
change property X

sensor to sense change in property X

and

message to object B

[/TABLE]

Logic bricks for object B:

[TABLE=“class: grid, width: 500”]

message from object A

and

Change property Y

[/TABLE]

add a property to object A,which commands desired property of object B…

You just have to connect properties of both objects…

let me show you logic bricks to do this:

Logic bricks for Object A:

[TABLE=“class: grid, width: 500”]

sensor

controller

actuator

mouse click

and

change in property X

sense change in property X

and

message to object B

[/TABLE]

Logic bricks for Object B:

[TABLE=“class: grid, width: 500”]

Message from object A

and

Change in property Y

[/TABLE]

Thats how you can change property of B from A.

I know how to make it in logic bricks but I need it in Python.

with the syntex :
owner["property name "]
you can eccess a property.

so as you can access property of object A,connect it to property of object B as i’ve shown before and change it with python.

I mean python script connected to object A sensor will change property of object A ,which is connected to property of object B.