molfoundry.include#

molfoundry.include(fName, checkDup=True, putDup=True, skipDup=True)#

Execute another MolFoundry script in the caller’s namespace.

Reads fName (after prefixFilename() prefixing) and executes it in the calling module’s global namespace, so its top-level definitions become available to the includer – textual inclusion, not import. While the file runs, its directory is pushed onto the prefix stack so that relative filenames inside it resolve relative to that file.

Parameters:
  • fName (str | CWDPath) – Path to the script to include, relative to the including file (or absolute, or a CWDPath to make it relative to the working directory instead).

  • checkDup (bool) – When True (the default), consult the record of already included files and act per skipDup if this file was seen.

  • putDup (bool) – When True (the default), record this file so later includes of it are recognized as duplicates.

  • skipDup (bool) – When True (the default), silently skip a file that was already included; when False, re-inclusion raises.

Raises:

LogicError – If checkDup and skipDup is False and the file has already been included.

Return type:

None