Skip to main content

A CLI and Python module for executing Blender scripts and managing Blender's Python environment. Built to support SceneProg projects.

Project description

🚀 SceneProgExec: Blender Python Script & Package Manager

SceneProgExec is a command-line tool and Python module that enables seamless execution of Blender scripts and package management within Blender's isolated Python environment.

🔥 Features

Execute Python scripts inside Blender
Install Python packages in Blender's Python environment
Perform a full reset (remove all third-party packages)
Automatically cleans up temporary files after execution
Works both as a CLI tool and a Python module
Debugging with LLM

📥 Installation

1️⃣ Install from PyPI

pip install sceneprogexec

OR Clone the Repository

git clone https://github.com/KunalMGupta/SceneProgExec.git
cd SceneProgExec
pip install .

2️⃣ Set Environment Variables

Before using SceneProgExec, set the required environment variables:

export BLENDER_PATH=/Applications/Blender.app/Contents/MacOS/Blender
export BLENDER_PYTHON=/Applications/Blender.app/Contents/Resources/4.3/python/bin/python3.11

To make this permanent, add the lines to your ~/.bashrc or ~/.zshrc:

echo 'export BLENDER_PATH=/Applications/Blender.app/Contents/MacOS/Blender' >> ~/.zshrc
echo 'export BLENDER_PYTHON=/Applications/Blender.app/Contents/Resources/4.3/python/bin/python3.11' >> ~/.zshrc
source ~/.zshrc

3️⃣ Run CLI Commands

Once installed, you can use sceneprogexec globally.


🛠️ Usage

🔹 Run a Python Script Inside Blender

sceneprogexec run my_script.py --target my_scene.blend

✅ Runs my_script.py inside Blender.

🔹 Run a Python Script Inside Blender with Debugging

sceneprogexec run my_script.py --target my_scene.blend --debug

✅ Runs my_script.py inside Blender with debugging.


🔹 Install Packages Inside Blender

sceneprogexec install numpy pandas

✅ Installs numpy and pandas inside Blender’s Python.


🔹 Install Packages With a Hard Reset

sceneprogexec install numpy pandas --reset

Removes all third-party packages before installing new ones.


🔹 Reset Blender's Python (Remove All Third-Party Packages)

sceneprogexec reset

🗑️ Deletes all third-party Python packages in Blender.


🏗️ Using as a Python Module

SceneProgExec can also be imported and used in Python scripts:

from sceneprogexec import SceneProgExec

executor = SceneProgExec()
executor.install_packages(["numpy"])
executor.run_script("my_script.py")
executor._delete_all_third_party_packages()  # Hard reset

script = """
import bpy
print("Hello, World!")
"""
executor(script, target="test.blend")

🔹 Run a Python Script Inside Blender with Debugging

executor = SceneProgExec()
executor.run_script("my_script.py", debug=True)

🚀 Automatic Cleanup

  • Temporary directory (blender_tmp) is deleted after execution.
  • No leftover logs or scripts clutter your system.

🛠️ Troubleshooting

Blender not found?
Ensure BLENDER_PATH and BLENDER_PYTHON are correctly set. Run:

echo $BLENDER_PATH
echo $BLENDER_PYTHON

Permission denied?
Try:

chmod +x /usr/local/bin/sceneprogexec

Blender script fails to execute?
Check the log:

cat blender_tmp/blender_log.txt

📝 License

This project is licensed under the MIT License.


👨‍💻 Author

Developed by Kunal Gupta
GitHub: KunalMGupta


Support the Project

If you find this tool useful, give it a ⭐ on GitHub!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sceneprogexec-0.1.6.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sceneprogexec-0.1.6-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file sceneprogexec-0.1.6.tar.gz.

File metadata

  • Download URL: sceneprogexec-0.1.6.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for sceneprogexec-0.1.6.tar.gz
Algorithm Hash digest
SHA256 a8e1afe7b6d2111c0848b3725d0724b6c142259fceff8122bc1971fa5e60452f
MD5 9b0f788ffda89237df4132d1619fd331
BLAKE2b-256 95037699b5309b15a5eedfd8a5fb5473ec1db3e4fd4e89c3b9e4d8d0af0d50fd

See more details on using hashes here.

File details

Details for the file sceneprogexec-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: sceneprogexec-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for sceneprogexec-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 308ed4d33a93da82fef8880196c56b55a09a49e8eeb5175025eaf037669a46ae
MD5 21a1fa0891b964fe59436fa897afdad0
BLAKE2b-256 8582196e0ea5d02d9eac83245d08eb1625d228ded26c7bd0f98d8647604ab102

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page