Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'mentioned,': 0.07; 'imported': 0.09; 'imports': 0.09; 'objects.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'stored': 0.10; "hasn't": 0.15; 'dictionary.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:accessing': 0.16; 'subject:created': 0.16; 'wrote:': 0.17; 'script.': 0.17; 'module': 0.19; 'import': 0.21; 'doc': 0.22; 'defined': 0.22; 'seems': 0.23; 'tried': 0.25; 'header:User-Agent:1': 0.26; 'module.': 0.27; 'header:X-Complaints-To:1': 0.28; 'run': 0.28; 'dictionary': 0.29; 'objects': 0.29; 'class': 0.29; 'received:comcast.net': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; 'skip:: 10': 0.35; 'pm,': 0.35; 'received:org': 0.36; 'execute': 0.37; 'two': 0.37; 'uses': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'called': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'most': 0.61; 'save': 0.61; 'email addr:gmail.com': 0.63; 'dangerous': 0.66; 'header :Reply-To:1': 0.68; 'reply-to:no real name:2**0': 0.72; 'angel': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Kene Meniru Subject: Re: Running external module and accessing the created objects Followup-To: gmane.comp.python.general Date: Mon, 11 Mar 2013 21:58:07 -0400 Organization: illom.org References: <513aecd3$0$6512$c3e8da3$5496439d@news.astraweb.com> <513E7B6B.5070608@davea.name> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: c-68-49-243-100.hsd1.md.comcast.net User-Agent: KNode/4.4.7 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Kene.Meniru@illom.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1363053512 news.xs4all.nl 6864 [2001:888:2000:d::a6]:41456 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41104 Dave Angel wrote: > On 03/11/2013 07:57 PM, Kene Meniru wrote: > > I hope you're just kidding. execfile() and exec() are two of the most > dangerous mechanisms around. import or __import__() would be much > better, as long as your user hasn't already run myapp.py as his script. > Tried __import__ and it seems to execute the myapp.py just like execfile however it only provides access to objects defined in the module myapp.py only. Like I mentioned, my program has multiple packages and the objects myappwin needs access to are stored in an object in another module called doc.py. - myapp.py provides the functions used to describe 3D objects - app.py is imported into myapp.py and is called by the functions after they create the 3D objects. - app.py uses another module called doc.py which app.py imports to save the objects in a class with a dictionary. - myappwin needs to access the dictionary in the class inside the doc module. -- Kene :::::::::::::::::: KeMeniru@gmail.com