On 3 Aug 2006 04:50:35 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi > I am new to python. I wanted to know if there is an opposite of "import"
Err, depends upon what you mean by opposite. If you want to remove the module from a namespace into which you imported it, you can do that with del: import amodule amodule.afunction() # Works fine del amodule amodule.afunction() # Will die now If you want to "de-import" a module in order that you can import a new, updated version, you can do that (with caveats) with the reload built-in function. Check out the docs. If you want a module to be able to specify what happens when it is imported elsewhere, well, you have some measure of control there, too. All the top level code will be executed (other than that in a "if n__name == '__main__'" block). If the import is of the "import spam" form, all names in the imported namespace will be available in the importing module. If the import os of the "from spam import *" form, only *public* names in the module namespace are made available to the importing module. Public names are those defined in a top level __all__ list, or not starting with an underscore of no such list has been defined. And if none of those are what you meant by the opposite of an import, you'll need to be more explicit. ;-) -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list