I am somewhat familiar with the Blender api, but the directory stuff still confuses me a little bit.
This is my current situation:
I am running a python script
script1.py through the blender text editor. That script needs to get variables from
script2.py. The only way I could find to import script2 into script1 while running in Blender is by adding script2 to the
startup file in Blender (Explained here https://docs.blender.org/api/current/info_overview.html?highlight=working%20directory#the-default-environment).
This does not work by itself, the following code reloads script2 every time script1 is ran in blender since I could have changed something:
import conFig import importlib importlib.reload(conFig) from conFig import *
The code I am writing needs to be run on both Mac and Windows. The variables in script2 let me switch paths easily depending on which os I'm currently on. As you can tell, this makes adding script2 to
setup every time I test between operating systems a clunky challenge and that I would prefer to avoid. It would be preferable if all these files (.blend included) were in the same folder that I can zip and email to my PC.
My question: I have spent the better part of two days trying to import script2 into script1 when they are both located in the same directory. And so far my current situation above is the only working result I could muster.
I tried the following methods:
But I couldn't manage to get it to work.
How do I import script2 into script1 in the same directory?