I am trying to write some scripts to test blender. I have developed some helper tasks that I would like to use from a common module. However when I move the task from the working script into a different file and try and get the script to import from the second file it does not work.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "E:\blender-addons\test\test_import_obj.py", line 14, in <module>
import test_helper
ModuleNotFoundError: No module named 'test_helper'
So I figured that I needed to at least set the PYTHONPATH to the current directory. However when I do that then the blender bit stops working
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "E:\blender-addons\test\test_import_obj.py", line 214, in <module>
main(infile, module)
File "E:\blender-addons\test\test_helper.py", line 22, in copy_plugin
bpy.ops.wm.addon_install(overwrite=True, filepath=zfile)
NameError: name 'bpy' is not defined
I am using windows to develop my scripts.
What am I missing?
USER/scripts/modules/folder and it can be imported withimport test_helper$\endgroup$scripts/addonsfolder? $\endgroup$/home/batfinger/.config/blender/2.80/scripts/addons/test_addon/__init__.pyI can re-install blender without fear of that user folder being touched. In realitytest_addon/is symbolically linked from elsewhere, but for all extents and purposes is in my user addons folder. Reload addon scripts using F8 shortcut tobpy.ops.script.reload(). Crunchbpy.utils.script_paths('addons')into the python console and it returns a list of locations where blender expects to find addons. $\endgroup$