Is there any way to access attributes from an imported module?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Oct 2 04:50:07 EDT 2011


Andrew Berg wrote:

> On 2011.10.02 01:55 AM, Steven D'Aprano wrote:
>> Have I missed something? Why can't you just import the module and call
>> the methods like you would for any other module and class?
>> 
>> import module
>> instance = module.Some_Class()
>> result = instance.method(some, arguments, may, be, needed)
>
> I need to affect the instance created in the main script; 

Then call the methods on the instance created in the main script. I'm still
failing to see your problem.



-- 
Steven




More information about the Python-list mailing list