• Docs »
  • How to import the toolkits

How to import the toolkitsΒΆ

At the beginning of most Python programs, functionality that resides in other files is imported with the import statement. Built-in modules are usually imported like the following:

import os, sys

Then functionality from those modules can be called by prefixing the method name with the module name as in sys.stdout.write() or os.exit(0).

OpenEye toolkits resides in the openeye module. For example OEChem TK can imported as:

from openeye.oechem import *

Where all methods and objects in the oechem namespace are pulled directly into the current script’s namespace. Since OEChem TK‘s objects and functions have unique names, there is little chance to have a name clash with this particular import * call.

Once the package is imported, objects can be created and methods can be called without the addition of namespace prefixes, resulting in simpler code.