pymel.core.general.baseTemplate

baseTemplate(*args, **kwargs)

This is the class for the commands that edit and/or query templates. In query mode, return type is based on queried flag.

Flags:

Long Name / Short Name Argument Types Properties
exists / ex bool ../../../_images/query.gif
  Returns true or false depending upon whether the specified template exists. When used with the matchFile argument, the query will return true if the template exists and the filename it was loaded from matches the filename given.
fileName / fn unicode ../../../_images/create.gif ../../../_images/query.gif
  Specifies the filename associated with the template. This argument can be used in conjunction with load, save or query modes. If no filename is associated with a template, a default file name based on the template name will be used. It is recommended but not required that the filename and template name correspond.
force / f bool ../../../_images/create.gif
  This flag is used with some actions to allow them to proceed with an overwrite or destructive operation. When used with load, it will allow an existing template to be reloaded from a file. When used in create mode, it will allow an existing template to be recreated (for example when using fromContainer argument to regenerate a template).
load / l bool  
  Load an existing template from a file. If a filename is specified for the template, the entire file (and all templates in it) will be loaded. If no file is specified, a default filename will be assumed, based on the template name.
matchFile / mf unicode ../../../_images/query.gif
  Used in query mode in conjunction with other flags this flag specifies an optional file name that is to be matched as part of the query operation.
silent / si bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Silent mode will suppress any error or warning messages that would normally be reported from the command execution. The return values are unaffected.
unload / u bool ../../../_images/create.gif
  Unload the specified template. This action will not delete the associated template file if one exists, it merely removes the template definition from the current session.
viewList / vl unicode ../../../_images/create.gif ../../../_images/query.gif
  Used in query mode, returns a list of all views defined on the template. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.baseTemplate

Example:

import pymel.core as pm

#    Determine if template exists
#
pm.baseTemplate ('foo.xml', exists=True)
# Result: False #
#