the following line
subBc = newDoc
will store a
BaseLink (a reference, a pointer) to
newDoc in your container, not the object itself. While Python's important syntax for bracket operators (
__getitem__) usually is really convenient, in the case of
BaseContainers it can obscure what you are actually doing. The verbose form of your call would be:
Which works because
BaseDocument is derived from
BaseList2D and therefor also from
C4DAtom (the type
BaseContainer.SetLink() does expect as its second argument). However, when this link is not properly serialized on saving the document (which is impossible with your floating document), this link would be a null pointer when the document is loaded again. You cannot store a
C4DAtom in a
BaseContainer. At least I am not aware of a way to do so. You can only store references, which need to be kept alive in order to resolve.
On a side note: This whole hijacking of the documents data container should not work in the first place, i.e. Cinema will just clear it out the container at your ID. I am a bit confused that you can actually read back your "hello" on a saved document.