Results 1 to 2 of 2

Thread: Is there a way to test if a library has already been opened?

  1. #1
    Senior Member
    Join Date
    Feb 2012
    Posts
    1,214

    Is there a way to test if a library has already been opened?

    Hi,

    I have several different python libraries that I use, and didn't want to keep them all open at the same time.

    Is there a way I can check if a library is already opened?

    Thanks

    Herb

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,771
    Hi Herb,

    The python import statement only loads a module once.

    Python does not officially support unloading modules.
    You can however test to see if a module is loaded using:

    type(sys.modules["modulename"])

    and if there are no references to it:

    del sys.modules["modulename"]

    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us