pymel.core.system.importFile

importFile(filepath, **kwargs)

Import the specified file. Returns the name of the imported file.

Flags:
  • loadNoReferences:

    This flag is obsolete and has been replaced witht the loadReferenceDepth flag. When used with the -open flag, no references will be loaded. When used with -i/import, -r/reference or -lr/loadReference flags, will load the top-most reference only.

  • loadReferenceDepth:

    Used to specify which references should be loaded. Valid types are all, noneand topOnly, which will load all references, no references and top-level references only, respectively. May only be used with the -o/open, -i/import, -r/reference or -lr/loadReference flags. When noneis used with -lr/loadReference, only path validation is performed. This can be used to replace a reference without triggering reload. Not using loadReferenceDepth will load references in the same loaded or unloaded state that they were in when the file was saved. Additionally, the -lr/loadReference flag supports a fourth type, asPrefs. This will force any nested references to be loaded according to the state (if any) stored in the current scene file, rather than according to the state saved in the reference file itself.

  • defaultNamespace:

    Use the default name space for import and referencing. This is an advanced option. If set, then on import or reference, Maya will attempt to place all nodes from the imported or referenced file directly into the root (default) name space, without invoking any name clash resolution algorithms. If the names of any of the new objects already exist in the root namespace, then errors will result. The user of this flag is responsible for creating a name clash resolution mechanism outside of Maya to avoid such errors. Note:This flag is intended only for use with custom file translators written through the API. Use at your own risk.

  • deferReference:

    When used in conjunction with the -reference flag, this flag determines if the reference is loaded, or if loading is deferred.C: The default is false.Q: When queried, this flag returns true if the reference is deferred, or false if the reference is not deferred. If this is used with -rfn/referenceNode, the -rfn flag must come before -q.

  • groupReference:

    Used only with the -r or the -i flag. Used to group all the imported/referenced items under a single transform.

  • groupName:

    Used only with the -gr flag. Optionally used to set the name of the transform node that the imported/referenced items will be grouped under.

  • renameAll:

    If true, rename all newly-created nodes, not just those whose names clash with existing nodes. Only available with -i/import.

  • renamingPrefix:

    The string to use as a prefix for all objects from this file. This flag has been replaced by -ns/namespace.

  • swapNamespace:

    Can only be used in conjunction with the -r/reference or -i/import flags. This flag will replace any occurrences of a given namespace to an alternate specified namespace. This namespace swapwill occur as the file is referenced in. It takes in two string arguments. The first argument specifies the namespace to replace. The second argument specifies the replacement namespace. Use of this flag, implicitly enables the use of namespaces and cannot be used with deferReference.

  • returnNewNodes:

    Used to control the return value in open, import, loadReference, and reference operations. It will force the file command to return a list of new nodes added to the current scene.

  • preserveReferences:

    Modifies the various import/export flags such that references are imported/exported as actual references rather than copies of those references.

Derived from mel command maya.cmds.file