Handling Blender Files

file.py contains functions useful in handling .blend files using bpy

bsr.blender_commands.file.save(path)[source]

Saves working blender environment to a blender file.

Return type:

bool

Parameters:
path: Path | str

File path to save the file to.

Returns:
bool:

Whether the file was successfully saved. In this case checked if the filepath exists.

Raises:
TypeError

If the type of the path parameter is not a Path or string

Examples

>>> import bsr

… # work on blender file

>>> blender_path: str | Path
>>> bsr.save(blender_path)
bsr.blender_commands.file.reload(path)[source]

Reloads the blender file to most recently saved state.

Return type:

None

Parameters:
path: Path | str

File path to save the file to.

Raises:
TypeError

If the type of the path parameter is not a Path or string

FileNotFoundError

If the passed-in filepath does not exist

Examples

>>> import bsr

… # work on blender file

>>> blender_path: str | Path
>>> bsr.reload(blender_path)