Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8350
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: Project-wide variable... |
| Date | 2011-06-24 02:27 -0400 |
| References | (2 earlier) <2cc8ba29-b669-4f1c-aa42-2e518402917c@p13g2000yqh.googlegroups.com> <mailman.339.1308852668.1164.python-list@python.org> <fb66f37c-c133-4905-b44f-c99b674f2ee2@x12g2000yql.googlegroups.com> <4e03f259$0$29975$c3e8da3$5496439d@news.astraweb.com> <a93ad81c-8c00-4183-a297-98475494b9c2@n5g2000yqh.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.353.1308896848.1164.python-list@python.org> (permalink) |
On 6/23/2011 11:49 PM, Gnarlodious wrote: > Let me restate my question. > Say I have a script Executable.py that calls all other scripts and > controls them: > > #!/usr/local/bin/python > from Module import Data > import ModuleTest > > ModuleTest.py has this: > > print(Data.Plist.Structure) > > Running Executable.py gives me this: > NameError: name 'Data' is not defined > > 1) Can I tell Executable.py to share Data with ModuleTest.py? After the import is complete, yes. import ModuleTest ModuleTest.Data = Data This works if the use of Data is inside a function that is not called during import, not if the use of Data is at toplevel or in a class statement outside a def. > or if that can't be done: > 2) Can I tell ModuleTest.py to "look upstream" for Data? Yes if ModuleTest imports Executable, but circular imports are a bad idea. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Project-wide variable... Gnarlodious <gnarlodious@gmail.com> - 2011-06-23 06:41 -0700
Re: Project-wide variable... Calvin Spealman <ironfroggy@gmail.com> - 2011-06-23 09:51 -0400
Re: Project-wide variable... Noah Hall <enalicho@gmail.com> - 2011-06-23 14:59 +0100
Re: Project-wide variable... Gnarlodious <gnarlodious@gmail.com> - 2011-06-23 07:09 -0700
Re: Project-wide variable... Peter Otten <__peter__@web.de> - 2011-06-23 16:42 +0200
Re: Project-wide variable... "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-06-23 08:20 -0700
Re: Project-wide variable... Gnarlodious <gnarlodious@gmail.com> - 2011-06-23 10:48 -0700
Re: Project-wide variable... Noah Hall <enalicho@gmail.com> - 2011-06-23 15:55 +0100
Re: Project-wide variable... Terry Reedy <tjreedy@udel.edu> - 2011-06-23 14:10 -0400
Re: Project-wide variable... Gnarlodious <gnarlodious@gmail.com> - 2011-06-23 19:01 -0700
Re: Project-wide variable... Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-24 02:11 +0000
Re: Project-wide variable... Gnarlodious <gnarlodious@gmail.com> - 2011-06-23 20:49 -0700
Re: Project-wide variable... Gnarlodious <gnarlodious@gmail.com> - 2011-06-23 21:01 -0700
Re: Project-wide variable... alex23 <wuwei23@gmail.com> - 2011-06-23 21:04 -0700
Re: Project-wide variable... Terry Reedy <tjreedy@udel.edu> - 2011-06-24 02:27 -0400
Re: Project-wide variable... Gnarlodious <gnarlodious@gmail.com> - 2011-06-24 04:30 -0700
Re: Project-wide variable... Terry Reedy <tjreedy@udel.edu> - 2011-06-24 17:19 -0400
Re: Project-wide variable... Guillaume Martel-Genest <guillaumemg@gmail.com> - 2011-06-23 10:18 -0700
Re: Project-wide variable... Noah Hall <enalicho@gmail.com> - 2011-06-23 18:42 +0100
Re: Project-wide variable... Gnarlodious <gnarlodious@gmail.com> - 2011-06-23 11:01 -0700
csiph-web