Creating a module that uses itself

Delaney, Timothy tdelaney at avaya.com
Mon Mar 18 01:20:29 EST 2002


> From: Asheesh Laroia [mailto:pan-news at asheeshenterprises.com]
> 
> I'm writing a PageMaker-to-specialized-HTML module (henceforth
> "pm2html").  In the module, I define the classes Article, 
> Headline, and
> Photo, among others.
> 
> In the Article class, I want to have a Headline object.  Is this
> possible?  Right now, ActivePython's PythonWin spits a syntax 
> error at me
> because the Headline class is not defined.  But I can't
> 
> 	import pm2html
> 
> (which is where the Headline object lives) because *that's 
> the file I'm
> working in*!
> 
> So, how do I create a module that uses objects it creates?

Post the code. Try not to include anything that isn't necessary (but don't
strip out what is - make sure that what you post fails in the same way).

Tim Delaney




More information about the Python-list mailing list