Hey everyone,
just to add a little disclaimer here, as Maxime gave a very hacking friendly answer with the a bit tame warning 'do it at your own risk'.
What you are tyring to do is out of scope of support because it is a violation of the threading restrictions. The whole core message system is about events and UI, both things that are inherently bound to the main thread.
Maxime's code just circumvents the main-thread check someone once put into our code for a reason, as that person also made sure to put a warning into the docs. When you are someone like Maxime, i.e., you know all the bits and bytes of Cinema 4D on a first-name basis, you can make a workaround like this work. But for everyone else I would strongly recommend not circumventing such things in production code. Just because a hack runs fine on a development machine, does not mean that a customer might not lose work due to a crash induced by such hack.
The underlying issue we talked about this morning, is that in C++ one can easily defer things to the main thread with the aptly named ExecuteOnMaainThread while in Python one cannot. We are aware of this issue but it is quite costly to solve. An outcome of this thread, was that we at least promoted the priority of the already existing ticket for this issue in our task pool. We can however give no ETA when we will fix this, as doing this will cost quite some time.
Cheers,
Ferdinand