Question

I know this is very evil, but is it possible to add an object to another module's globals, something like:

#module dog.py
import cat
cat.globals.addVar('name','mittens')

and

#module cat.py
print name #mittens
Was it helpful?

Solution

setattr(cat, 'name', 'mittens')

or

cat.name = 'mittens'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top