Thanks!! This makes sense. And you were right about my misunderstanding.
Michael Tobis wrote: > I think the answers so far are unnecessarily confusing and off the > mark. > > Here is what I think you think you want to know: > > 1) import only works once. If you try import again, it will see the > module already exists, and will ignore you > > 2) the functionality you think you want is reload. > >>> reload mymodule > will essentially reimport mymodule after the first time. > > However, what you think you want is not what you want, which is why the > experienced people are giving misleading and overcomplicated answers. > Normally reload is a fairly advanced feature and beginners don't need > it. > > Usually, an import statement invokes a module containing a bunch of > definitions (usually functions or classes, but sometimes even > constants), but it doesn't DO anything unless it is invoked as the main > program. > > So after you satisfy yourself that "reload" does what you want, try to > think about how you would work things so you don't need it. > > For instance, instead of something like > > #mystuff.py > > print "hello ", > print "world" > > # end of file > > > > >>> import mystuff > hello world > >>> import mystuff > > >>> > > is > > > > ### newstuff.py > > def newstuff(): > print "hello", > print " world" > > # end of file > > > > >>> from newstuff import newstuff > >>> newstuff() > hello, world > >>> newstuff() > hello, world > > > hth > mt -- http://mail.python.org/mailman/listinfo/python-list