Post #5279: As a premise, the relative path is relative to the pie_menu_editor package its
📋 Metadata
- Author: Pluglug
- Date: 2024-11-19 20:48:20
- Type:
answer - Quality Score: 8/10
- Reply to: post_05277
- Replies (1): post_05281
🏷️ Tags
python-scripting beginner solved
⚙️ Related PME Features
- 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