The other answer is perfectly valid although I would have added a list of the builtin available namespace functions :
print([k for k in bpy.app.driver_namespace.keys()])
>> 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign',
'cos', 'cosh', 'degrees', 'dist', 'erf', 'erfc', 'exp', 'expm1', 'fabs',
'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'isclose',
'isfinite', 'isinf', 'isnan', 'isqrt', 'lcm', 'ldexp', 'lgamma', 'log', 'log1p',
'log10', 'log2', 'modf', 'pow', 'radians', 'remainder', 'sin', 'sinh', 'sqrt',
'tan', 'tanh', 'trunc', 'prod', 'perm', 'comb', 'nextafter', 'ulp', 'pi', 'e',
'tau', 'inf', 'nan', 'bpy', 'noise', 'clamp', 'lerp', 'smoothstep'
Additionnally you can access a list of "builtin" keys with
print([k for k in bpy.app.driver_namespace["__builtins__"]])
>> 'abs', 'all', 'any', 'ascii', 'bin', 'breakpoint', 'callable', 'chr', 'compile',
'delattr', 'dir', 'divmod', 'eval', 'exec', 'format', 'getattr', 'globals',
'hasattr', 'hash', 'hex', 'id', 'input', 'isinstance', 'issubclass', 'iter',
'aiter', 'len', 'locals', 'max', 'min', 'next', 'anext', 'oct', 'ord', 'pow',
'print', 'repr', 'round', 'setattr', 'sorted', 'sum', 'vars', 'None', 'Ellipsis',
'NotImplemented', 'False', 'True', 'bool', 'memoryview', 'bytearray', 'bytes',
'classmethod', 'complex', 'dict', 'enumerate', 'filter', 'float', 'frozenset',
'property', 'int', 'list', 'map', 'object', 'range', 'reversed', 'set', 'slice',
'staticmethod', 'str', 'super', 'tuple', 'type', 'zip', '__debug__',
'BaseException', 'Exception', 'TypeError', 'StopAsyncIteration', 'StopIteration',
'GeneratorExit', 'SystemExit', 'KeyboardInterrupt', 'ImportError', 'ModuleNotFoundError',
'OSError', 'EnvironmentError', 'IOError', 'WindowsError', 'EOFError', 'RuntimeError',
'RecursionError', 'NotImplementedError', 'NameError', 'UnboundLocalError',
'AttributeError', 'SyntaxError', 'IndentationError', 'TabError', 'LookupError',
'IndexError', 'KeyError', 'ValueError', 'UnicodeError', 'UnicodeEncodeError',
'UnicodeDecodeError', 'UnicodeTranslateError', 'AssertionError', 'ArithmeticError',
'FloatingPointError', 'OverflowError', 'ZeroDivisionError', 'SystemError',
'ReferenceError', 'MemoryError', 'BufferError', 'Warning', 'UserWarning',
'EncodingWarning', 'DeprecationWarning', 'PendingDeprecationWarning',
'SyntaxWarning', 'RuntimeWarning', 'FutureWarning', 'ImportWarning', 'UnicodeWarning',
'BytesWarning', 'ResourceWarning', 'ConnectionError', 'BlockingIOError',
'BrokenPipeError', 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionRefusedError',
'ConnectionResetError', 'FileExistsError', 'FileNotFoundError', 'IsADirectoryError',
'NotADirectoryError', 'InterruptedError', 'PermissionError', 'ProcessLookupError',
'TimeoutError', 'open', 'quit', 'exit', 'copyright', 'credits', 'license', 'help'
Note some of these functions don't return a number-compatible value (string, or custom classes) so I wouldn't advise trying to use them.
WARNING: Since it's a mini Python interpreter you risk inadvertently causing side effects. For example try typing quit()
in a driver expression field (save your file first) :)
There is also a list of hardcoded functions (Source) :
'bool', 'float', 'int', 'clamp', 'lerp', 'smoothstep"
.
It seems there are three additional special cases,
'frame'
which returns the current frame. Source
'self'
which returns the evaluated object. Source
'depsgraph'
which can be used to retrieve data from the current context. Source
I would also add that the title and body of the question are misleading. You make the assumption that #
grants access to the list of driver namespace functions, but the purpose of writing #
in a property field is to automatically setup a driver. It saves you a few clicks you need to manually setup a driver :
- Right click in the field
- Add Driver
- Then in the popup delete the variable
- Write the driver expression in the field
For example you can write #min(2,cos(2))
or #2
to setup drivers. These two concepts (#
and namespace functions) are independant of each other.