What is the cleanest way to for a module to access objects from the script that imports it?

noamsml at gmail.com noamsml at gmail.com
Fri Oct 27 17:53:45 EDT 2006


Hi,

I am new to python and am currently writing my first application. One
of the problems I quickly ran into, however, is that python's imports
are very different from php/C++ includes in the sense that they
completely wrap the imported script in a module object. One of the
problems with this was that a plugin system that I am making requires
use of objects, classes and the such from the original script. Thus, on
one hand, I am hesitant to use execfile(), since I *do* want to wrap
the plugin up, but on the other hand, I want the plugin to be able to
use functions from the original script. Any ideas?

Sincerely,
Noam Samuel.




More information about the Python-list mailing list