Utilities (bpy.utils)

This module contains utility functions specific to blender but not assosiated with blenders internal data.


Returns a list of paths to external files referenced by the loaded .blend file.

Parameters:absolute (boolean) – When true the paths returned are made absolute.
Returns:path list.
Return type:list of strings
bpy.utils.load_scripts(reload_scripts=False, refresh_scripts=False)

Load scripts and run each modules register function.

  • reload_scripts (bool) – Causes all scripts to have their unregister method called before loading.
  • refresh_scripts (bool) – only load scripts which are not already loaded as modules.
bpy.utils.modules_from_path(path, loaded_modules)

Load all modules in a path and return them as a list.

  • path (string) – this path is scanned for scripts and packages.
  • loaded_modules (set) – already loaded module names, files matching these names will be ignored.

all loaded modules.

Return type:


bpy.utils.preset_find(name, preset_path, display_name=False)

Returns a list of paths for a specific preset.


Register a subclass of a blender type in (Panel, Menu, Header, Operator, KeyingSetInfo, RenderEngine).

If the class has a register class method it will be called before registration.


ValueError exception is raised if the class is not a subclass of a registerable blender class.

bpy.utils.register_module(module, verbose=False)
bpy.utils.resource_path(type, major=2, minor=57)

Return the base path for storing system files.

  • type (string) – string in [‘USER’, ‘LOCAL’, ‘SYSTEM’].
  • major (int) – major version, defaults to current.
  • minor (string) – minor version, defaults to current.

the resource path (not necessarily existing).

Return type:


bpy.utils.script_paths(subdir=None, user=True)

Returns a list of valid script paths from the home directory and user preferences.

Accepts any number of string arguments which are joined to make a path.

bpy.utils.smpte_from_frame(frame, fps=None, fps_base=None)

Returns an SMPTE formatted string from the frame: “HH:MM:SS:FF”.

If fps and fps_base are not given the current scene is used.

bpy.utils.smpte_from_seconds(time, fps=None)

Returns an SMPTE formatted string from the time in seconds: “HH:MM:SS:FF”.

If the fps is not given the current scene is used.


Unload the python class from blender.

If the class has an unregister class method it will be called before unregistering.

bpy.utils.unregister_module(module, verbose=False)
bpy.utils.user_resource(type, path='', create=False)

Return a user resource path (normally from the users home directory).

  • type (string) – Resource type in [‘DATAFILES’, ‘CONFIG’, ‘SCRIPTS’, ‘AUTOSAVE’].
  • subdir (string) – Optional subdirectory.
  • create (boolean) – Treat the path as a directory and create it if its not existing.

a path.

Return type:



Previous topic


Next topic

Path Utilities (bpy.path)