Messaging from Python

I have an object #1 with a python script attached to it, and in that script I have a reference to another object (#2). Two questions…

  • From object #1’s script, how do I send a message to object #2’s message sensor from python?
  • If the object #2 has a python script attached, how would I invoke a function defined in object #2’s script from object #1’s script?Thanks!

You could always create a data latch in the registry that any script can reference at any time.

I’m sorry, I’m not familiar with data latches or a registy in Blender.

Is is possible for a script to send a message to another object from python?
Is it possible for a script in one object to call a function defined in the script of another object?