Niklasro <nikla...@gmail.com> wrote: > I got 2 files main.py and i18n both with > webapp request handlers which I would like access the variable.
I'd probably use a module for this. Create a third file, called something like shared.py, containing the line that bruno gave above: url = os.environ.get("HTTP_HOST", os.environ["SERVER_NAME"]) Then from within both main & i18n you can 'import shared' and access the variable as 'shared.url'. Python only actually executes a module the first time it's imported, every other import will be given a reference to the same module object. This also lets you share temporary data between modules. Any module that imports 'shared' can add an attribute to it ('shared.foo = "barbaz"') that will be visible to all other modules that have (or will have) imported it. -- http://mail.python.org/mailman/listinfo/python-list