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

Rhodri James rhodri at wildebst.demon.co.uk
Sun Oct 2 20:04:21 EDT 2011


On Sun, 02 Oct 2011 06:12:05 +0100, Andrew Berg  
<bahamutzero8825 at gmail.com> wrote:

> I'm not sure the subject's wording is the best, but I'll try to explain.
> I have a main script that imports several modules and I need to be able
> to call methods from a class instance inside that main script from a
> module.

Do you mean that one of the imported modules wishes to use an instance
created in the main script?  If that's the case, you're going to have
to pass the instance to the module somehow, since the module knows
nothing of what if anything has imported it.

-- 
Rhodri James *-* Wildebeest Herder to the Masses



More information about the Python-list mailing list