> I'm implementing a plugin-based program, structured like the example > below (where m1 in the main module, loading m2 as a plugin). I wanted > to use a single global variable (m1.glob in the example) to store some > config data that the plugins can access. However, the output shown > belown seems to imply that glob is *copied* or recreated during the > import in m2. Am I missing something? I thought m1 should be in > sys.modules and not be recreated during the import in m2.
Yes, you are missing that your first glob is in __main__.glob, _not_ in m1.glob. To make that happen, use something like this: glob = [1] def main(): pass if __name__ == "__main__": import m1 m1.main() Diez -- http://mail.python.org/mailman/listinfo/python-list