Multiple instances of modules

John Roth newsgroups at
Mon Sep 15 17:57:28 CEST 2003

"Daniel Pryde" <ababo_2002 at> wrote in message
news:cf5c25e9.0309150733.4543eada at
> Hi there.
> I'm currently trying to learn Python, my aim being to create my final
> year project at university using only Python instead of Java. I've run
> into a problem though while trying to make multiple instances of
> modules.
> For example, say I made a module which held details of an audio
> compact dic (album name, track names, etc..), and wanted my Python
> script to make a record collection using multiple CD's, I can't make
> them seperately. I tried using the 'import module as name' format, but
> any changes made to one instance affects the other. I assume this is
> because Python is simply referencing the one instance of rather
> than seperate ones. Is there a solution to this that doesn't involve
> using cPython or Jython? Any help would be greatly appreciated.

I suspect you're trying to store your data in the module itself.
That's not going to work because Python only loads one copy
of a module, by design.

As Anton suggests, please tell us a bit more about what you're
trying to do and the approach you're taking.

John Roth

More information about the Python-list mailing list