Running external module and accessing the created objects

Steven D'Aprano steve+comp.lang.python at
Sat Mar 9 09:03:31 CET 2013

On Fri, 08 Mar 2013 22:06:28 -0500, Kene Meniru wrote:

> Program summary:
> I have a module called that imports another module called
> Functions in are used in to describe 3D objects.
> These objects are saved in another object described in

What do you mean, "objects are saved in another object"?

> contains a function called view(). When called in, it
> signals the end of object descriptions. Presently all objects contained
> in are exported to either POV-Ray or OpenSCAD file format
> depending on the argument given to view().
> My Issues:
> I have decided I want to provide a preview of the objects using opengl
> (pyglet). So I am trying to create another module called which
> the user can launch with as an argument.

What happens if the user launches appwin with a different argument?

If appwin can only take one, compulsory, argument, then it's silly to 
require it as an argument. Just have appwin automatically import, 
and do whatever it needs.

> When each object is
> described in, I want the user to be able to switch to,
> provide a signal that makes redraw the screen to show any
> modifications (perhaps with the enter key).

This makes no sense to me. Are you saying that appwin opens a text editor 
that allows the user to edit the source code?

> I do not want to invest much time with now as I am still
> coding Right now, just subclasses
> pyglet.window.Window().
> I do not want to merge and I want them to be two
> separate applications because I want to retain the option of either
> console or many different window interfaces.

Making them a single module still retains the option of console or many 
different window interfaces.

> The problem then is:
> How can I run which will then execute to create the
> objects to be saved in 

I don't know. How does create the objects? Suppose it users a 
function called "create". Then you would do this in appwin:

import user

> Then when view() is encountered to be
> able to access the objects stored in in

What do you mean by "view() is encounted"? 

How would you access the objects stored in Suppose you access 
them using a list called "list_of_objects". Then in

import doc
for obj in doc.list_of_objects:

where you have to write the function "do_something_with", to do whatever 
it is you want to do.

By the way, calling a module "doc" which is not for *documentation* is a 
bad idea.


More information about the Python-list mailing list