Helper Script
The suggested method is to edit your scripts externally, and use the following script to run it in your Blender scene.
import bpy
import os
filename = os.path.join(os.path.dirname(bpy.data.filepath), "my-script-name.py")
exec(compile(open(filename).read(), filename, 'exec'))
This script will load your "my-script-name.py" and run it whenever you press the RunScript button. This script also uses the path of the Blender file to find your python script, so there are some requirements for this script to run correctly.
- You must save your .blend file first
- You must co-locate your script file with your .blend file
Scripting Externally
In regards to scripting externally, there are a number of really good application designed for coding in python. If you don't want to go through the hassle of finding, downloading and installing one, you can always open another instance of Blender and use that as your developing program, and still use the script above in your testing instance.
No comments:
Post a Comment