Sending objects through messaging between gatways

No, python code is not serializable to travel through a network packet, nor is there any way to ensure everything that could get called would be included.

Distribute just the code in projects. Perhaps a dedicated project.

Run the code with indirection, something like this:

You message payload and return payload do have to be serialiazable.