ImportError: cannot import name 'update_text' from
Blender 4.0 beta Windows 11. Interesting enough 2.1.1 does not throw this error.
File "C:\blender-4.0\4.0\scripts\modules\addon_utils.py", line 364, in enable
mod = importlib.import_module(module_name)
File "C:\blender-4.0\4.0\python\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\ScriptToButton\__init__.py", line 3, in <module>
from . import properties, preferences, update, operators, functions, panels, dynamic_panels, menus
File "C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\ScriptToButton\properties.py", line 7, in <module>
from .functions import update_text
ImportError: cannot import name 'update_text' from 'ScriptToButton.functions' (C:\Users\USER\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\ScriptToButton\functions.py)
Ok, I can only test on Windows 10 and the Version 2.2.1 of the Add-on does not throw this error.
Did you use the update Feature of the Add-on to upgrade to the new Version? In this case, you could solve this problem by uninstalling the current add-on. Downloading the current version and installing it.
WARNING If you uninstall the Add-on your saved script will be gone too.
Therefore, you can copy the content of the storage folder at the location %appdata%\Blender Foundation\Blender\4.0\scripts\addons\ScriptToButton\Storage to a temporary folder and import the files back after reinstallation.
Does this bug still appear with the new Blender 4.0.1 version?
I will test it out
Hi! Here an error when I try to Load button from disk: on Blender 4.0.1 - Windows 11 Script to Button 2.2.2
bpy.ops.stb.load(texts=[{"name":"Text", "name":"Text", "select":False}, {"name":"Text.001", "name":"Text.001", "select":False}])
Python: Traceback (most recent call last):
File "C:\Users\miche\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\ScriptToButton\operators.py", line 257, in execute
fails = functions.load(context)
File "C:\Users\miche\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\ScriptToButton\functions.py", line 85, in load
scene.stb[0].selected = True
IndexError: bpy_prop_collection[index]: index 0 out of range, size 0
I fixed the issue mentioned by @michelepoletto3d with the new Version 2.2.3