While working on my newest script, I was thinking, is there a way to write a code to trace back to the scripts .py file location to locate a path fragment? Like, if my path was C:\Blender\Script\Texture\Texture.png and the script.py was located in the Script file and the code would say to begin looking in the .py file location and try to find the path with the fragment \Texture\Texture.png
That way even if the script file location changes, it can still locate the texture within the script’s file
Like, if the script file location changed from C:\Blender\Script to C:\Blender\DownloadedFiles\Script or anything like that, it still starts in the Script file and finds the Texture file and the Texture.png within it.
Will this still work if the main file location were to change? I’m mainly having trouble with figuring out how to keep the file path from being lost when someone downloads it, since I’m using an image file for the add-on and not a procedural texture. Although, now that I think about it, I may be able to use a procedural texture instead.
I’ll let you know if this post is still relevant momentarily.