Kįri Haršarson <[EMAIL PROTECTED]> writes:

> Hi all,
> 
> I write Python .ASP pages that import utility modules that I have also
> 
> written.
> 
> The utility modules need to access globally defined objects
> such as the Session and Response objects.
> 
> They are defined in global scope, however.
> 
> How can I access these objects from the imported module ?
> 

Pass them as parameters to the module, or store them in the imported
module by doing something like this:

import my_module
my_module.Session = Session

or:
<in my_module>
class MyClass(object):
    _Session = None
    def SetSession(cls, session):
        cls._Session = session
    SetSession = classmethod(SetSession)


</in my_module>


from my_module import MyClass
MyClass.SetSession(Session)

-- 

Vennlig hilsen 

Syver Enstad


_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to