@bentraje I don't have that much to add on your topic since I think @zipit already explained everything nicely.
In any case some good resource for you about how global variable works in Python Global keyword in Python and Mutable vs Immutable Objects in Python.
Regarding your last question, I think you should open a new topic, but the short answer there is no way to pass directly a variable with a MessageData, the best way is to use a scope accessible by both part and store this variable in this shared scope (can be global or any other).
Cheers,
Maxime.