Scripting API examples#

The Prism python scripting API can be used to customize various features of Prism and trigger actions. Almost every feature, which is available through the GUI can be accessed by external python scripts. Below there is a list of examples:


Create a new Prism instance:

import sys
sys.path.append("C:/Program Files/Prism2/Scripts")

import PrismCore
core = PrismCore.create(prismArgs=["noUI"])

# use this if you want to load the previously active project
core = PrismCore.create(prismArgs=["noUI", "loadProject"])

# use this is you want to show the GUI
# core =["loadProject"])


Create a new project:

name = "My Project Name"
path = "D:/Projects/myProject"
core.projects.createProject(name, path, preset="Default")

Change the active project:

path = "D:/Projects/myProject"


Create an assetfolder:

entity = {
    "type": "assetFolder",
    "asset_path": "MyFolder"

Create an asset:

entity = {
    "type": "asset",
    "asset_path": "MyFolder/MyAssetName"

Create a shot:

entity = {
    "type": "shot",
    "sequence": "a",
    "shot": "0010",
frameRange = [1001, 1040]
core.entities.createEntity(entity, frameRange=frameRange)

Create a department:

entity = {
    "type": "shot",
    "sequence": "a",
    "shot": "0010",
department = "fx"

core.entities.createDepartment(department, entity, createCat=False)

Create a task:

entity = {
    "type": "shot",
    "sequence": "a",
    "shot": "0010",
department = "fx"
task = "fire"

#  this function might get renamed in future versions
core.entities.createCategory(entity, department, task)

Create a scenefile from a preset:

entity = {
    "type": "shot",
    "sequence": "a",
    "shot": "0010",
department = "fx"
task = "fire"

#  get all available preset of the current project
presets = core.entities.getPresetScenes()

#  get the first preset, which is a Houdini scenefile
fileName = [f for f in presets if f.endswith(".hip")][0]

    comment="high speed",

Getting Existing PrismCore Instance#

Inside of a DCC you can use the existing PrismCore instance to access the Prism Python API.
This is preferred over creating a new PrismCore instance.

Inside of Blender, Houdini, Maya and Substance Painter

import PrismInit
core = PrismInit.pcore

Inside of 3dsMax, Nuke and Unreal Engine the PrismCore instance is defined globally in the pcore variable.

Managing Plugins#

Check if a plugin is loaded:

pluginName = "USD"
plugin = core.plugins.getPlugin(pluginName)
isLoaded = plugin is not None
if isLoaded:
    print("plugin %s is loaded from path: %s" % (pluginName, plugin.pluginPath)

Load a plugin:

# by name

# by path

Check if a pluginpath is in the plugin config and can be loaded, if not add it to the config:

pluginPath = "C:/path/to/plugin/USD"
if not core.plugins.canPluginBeFound(pluginPath):

Remove a pluginpath from the plugin config, so it won’t get loaded:

pluginPath = "C:/path/to/plugin/USD"

Install a Plugin:


Uninstall a Plugin:

plugin = core.getPlugin("Houdini")

Add a DCC integration:

import os
path = os.environ["USERPROFILE"] + "/Documents/houdini19.5"
core.integration.addIntegration("Houdini", path=path)

Remove a DCC integration:

import os
path = os.environ["USERPROFILE"] + "/Documents/houdini19.5"
core.integration.removeIntegration("Houdini", path=path)

Texture Library#

Ingest textures:

#  getting the plugin instance
plugin = core.getPlugin("TextureLibrary")

# specifying the texture paths
textures = [

#  specifying the location. Available options are the items in the location dropdown in the Texture Library window
location = "Assets"

#  specifying the assetname including assetfolders
asset = {"type": "asset", "asset_path": "MyFolder/MyAssetName"}

# specifying subfolders where the files will be copied to
subfolders = "proxies/v0001"

#  ingesting the textures into the project
plugin.ingestTextures(textures, location, asset=asset, subfolders=subfolders)

#  adding textures to the project library instead to a specific asset
location = "Project Library"
plugin.ingestTextures(textures, location, subfolders=subfolders)