Hi,
I am not quite sure if I understand you correctly here, but generally speaking, no, you cannot access attributes of the module of Cinema's live interpreter from some other module. The usual way to send something from document A to document B would be using Cinema's message system. But if you do not want to do this, you can simply insert your data into the interpreter. There are multiple places you can choose from and they are all equally bad. Here is an example for inserting data as fake modules into the modules dictionary of the interpreter, which at least looks somewhat gracefully. But this is generally a bad idea, you have been warned.
Cheers,
zipit
"""Put this into the script manager and run it twice. The first time it
will say that it did not find any data and instead stored some, and the
second time it will retrieve this data.
You should keep in mind that this data is only as long present as long
Cinema does not restart its Python Virtual Machine (which to my knowledge
does not happen, but you never know). This (obviously) also means that
this won't work with running c4dpy from the console in any fashion.
Cinema's message system or simply writing the data to file would be much
more suitable solutions. If you are using this, you should at least clean
up the module dictionary after you are done.
"""
# We try to access our data by importing them.
try:
import some_string
import some_object
print "Found data:"
print some_string
print some_object
# If no data is present, we write into the system module dictionary.
except:
import types
import sys
# Some data floating around we want to pass around in the interpreter.
SOME_STRING = "Bob is your uncle."
SOME_OBJECT = [3, 1, 4, 1, 5]
# Now comes the really, really, really, ..., really bad stuff. We
# just insert our data into the module dictionary.
for name, data in (("some_string", SOME_STRING),
("some_object", SOME_OBJECT)):
# Make sure we do not overwrite anything important.
if name not in sys.modules:
sys.modules[name] = data
# The assumption here is that if something is there and it is not a
# module, we probably put it there ourselves.
elif not isinstance(sys.modules[name], types.ModuleType):
sys.modules[name] = data
# From now on we can import this data from anywhere, as long as the
# interpreter instance is kept alive.
print "No data was present, inserted data into the module dictionary."```