How can I run my exe file from the blender?
I added a new panel, added a button to it, and when I clicked, I need to run the file.
import bpy
import os
import subprocess
path = “C:\myfile.exe”
path = os.path.abspath ( bpy.path.abspath (path) )
subprocess.Popen (path)
You can take a look at how I solved it in the Blender integration for LuxCore:
Your addon probably can not register because operator class names have to follow a specific naming convention.
Your operator class should be named “MESHT_OT_add_cube_sample” because of the bl_idname.
Indentation!
def execute (self, context):
path = "C:\myfile.exe"
path = os.path.abspath ( bpy.path.abspath (path) )
subprocess.Popen (path)
return {'FINISHED'}
Make sure you use forward slash (/) and not backslash ():
path = “C:/myfolder/myfile.exe”
By the way, it is totally pointless to post an error message in a language other than English without a translation.