Post #5279: As a premise, the relative path is relative to the pie_menu_editor package its

📋 Metadata

🏷️ Tags

python-scripting beginner solved

  • Python Scripting
  • Macro Editor

💬 Content

As a premise, the relative path is relative to the pie_menu_editor package itself.
Thus, you can call files located inside the pie_menu_editor directory like this:

execute_script("say_hello.py")
execute_script("./say_hello.py")
# Hello, PME!
# I'm right here at: C:\Users\pluglug\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\pie_menu_editor\say_hello.py

You may already know that adding dots allows you to reference the parent directory:

execute_script("../say_hello.py")
# Hello, PME!
# I'm right here at: C:\Users\pluglug\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\addons\say_hello.py

If you need to go up multiple levels, instead of adding more dots, you should use multiple ../ like this:

execute_script("../../say_hello.py")
# Hello, PME!
# I'm right here at: C:\Users\pluglug\AppData\Roaming\Blender Foundation\Blender\4.2\scripts\say_hello.py

❤️ 1 likes


🔗 View on Blender Artists