Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Q&A, Tips, Tricks and Howto

Reply
 
Thread Tools Display Modes
Old 09-16-2021, 09:07 AM   #1
gnai29
Human being with feelings
 
Join Date: Aug 2021
Posts: 3
Default Exiting REAPER after python script in a function is called with a button

Hello all,
I have this GUI made with the Scythe module, very straight forward and useful tool for this purpose.
I got recently blocked at trying to exit Reaper by calling one function when the user clicks that Button.
Code:
local function launch_potion()
  local potion_path = "~/Documents/REAPER/extract_potion.py"
  local cmd = string.format("~/venv/bin/python3 %s", potion_path)
  --reaper.atexit(os.execute('~/venv/bin/python3 ~/Documents/REAPER/extract_potion.py'))
  os.execute(cmd)
  --Scythe.quit = true

end

local window = GUI.createWindow({
    name = "SAUCE",
    w = 50,
    h = 50,
})

layer = GUI.createLayer({name = "Layer"})

layer:addElements(GUI.createElements(

{
    name = "launch_btn",
    type = "Button",
    x = 40,
    y = 40,
    w = 250,
    caption = "Launch Potion",
    func = launch_potion
}
))

window:addLayers(layer)
window:open()


GUI.Main()
So whenever the user click that `Launch Potion` Button, an external python script GUI is being launched, and my reaper GUI or even Reaper itself stay open unless I force quit from terminal or the usual force quit of MacOS.
I even tried including a `subprocess` in the py script calling `pkill REAPER` but no luck.
Not sure if that's even supported by Reaper.
I would appreciate it if someone can show me another way to do this please.
Thank you!

Last edited by gnai29; 09-16-2021 at 02:43 PM.
gnai29 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:01 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.