Project-wide variable...

Terry Reedy tjreedy at udel.edu
Thu Jun 23 14:10:55 EDT 2011


On 6/23/2011 10:09 AM, Gnarlodious wrote:
> On Jun 23, 7:59 am, Noah Hall wrote:
>>>> >from a import x
>
> I'm doing that:
> import Module.Data as Data
>
> However I end up doing it in every submodule, so it seems a little
> redundant. I wish I could load the variable in the parent program and
> have it be available in all submodules. Am I missing something?

Yes. Make a project ~template.py file that includes the common import.
Mine is something like

#!python3
  '''project_dir/.py -- 2011
Copyright Terry Jan Reedy

'''
from test import ftest,itest


def test_main():


if __name__ == '__main__':
     test_main()

-- 
Terry Jan Reedy




More information about the Python-list mailing list