Summary - Background
- Created a text drivers.py file in Gedit
- Opened drivers.py in Blender Text Editor
- Selected [x] Register
Summary - Issue
The scripts are available to my scaling drivers
- No problem there
When I try to run a test value in the python console I get the error
- NameError: name 'driver_Combo' is not defined
Summary - Question
Do I need to do something to make the (external) scripts available in the Python Console ?
Full Details
Just recently started learning Blender.
I am using driver scripted expressions for [ Transform ] [ Scale ] of objects.
I was creating (and testing) scripts in the Python Console:
- all good with achieving my driver scaling
- scripts created in Python Console were not being saved with my .blend
Now I have moved them into the text editor:
- Created a text drivers.py file in Gedit
- Opened drivers.py in Blender Text Editor
- Selected [x] Register
This is the content of drivers.py
import bpy
from math import degrees, radians
from math import pi
from math import sin
# def function
def driver_Combo(time):
radius = max(abs(sin(radians(time))),abs(sin(radians(time+90))))
if time > 360:
radius = 0
return radius
# add function to driver_namespace
bpy.app.driver_namespace['driver_Combo'] = driver_Combo
I'd like to have the scripts available in the Python Console to test values.
How do I make the scripts available ?
Thanks.
from drivers import driver_Combo
in the py console. $\endgroup$