# Blink GUI closes immediately after wait(w) when launched via PyJulia

**URL:** https://discourse.julialang.org/t/blink-gui-closes-immediately-after-wait-w-when-launched-via-pyjulia/128138
**Category:** New to Julia
**Created:** [April 16, 2025, 7:20pm UTC](https://discourse.julialang.org/t/blink-gui-closes-immediately-after-wait-w-when-launched-via-pyjulia/128138 "2025-04-16T19:20:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![dmr07](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmr07/32/215759_2.png) [@dmr07](https://discourse.julialang.org/u/dmr07)
#### Post date: [April 16, 2025, 7:20pm UTC](https://discourse.julialang.org/t/blink-gui-closes-immediately-after-wait-w-when-launched-via-pyjulia/128138/1 "2025-04-16T19:20:02Z")

</div>

![image](https://global.discourse-cdn.com/julialang/original/3X/2/5/25617e8210411248d344e46ebd0682fa7a0a0e26.png)

This is a sample of a program im trying to run. My endgoal is to compile it into a .exe file to share.  
I’m new to Julia and coding in general. The window immediately closes after I run it. How can I fix this?

---

<div class="post-metadata">

### Author: ![dmr07](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmr07/32/215759_2.png) [@dmr07](https://discourse.julialang.org/u/dmr07)
#### Post date: [April 16, 2025, 7:21pm UTC](https://discourse.julialang.org/t/blink-gui-closes-immediately-after-wait-w-when-launched-via-pyjulia/128138/2 "2025-04-16T19:21:41Z")

</div>

![image](https://global.discourse-cdn.com/julialang/original/3X/5/4/5447d98ec33f13e328d5a3b870c8c3bd592ebc13.png)

The program opens successfully but once Blink is finished loading and it displays, the window closes almost instantly.

---

<div class="post-metadata">

### Author: ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)
#### Post date: [April 16, 2025, 8:06pm UTC](https://discourse.julialang.org/t/blink-gui-closes-immediately-after-wait-w-when-launched-via-pyjulia/128138/3 "2025-04-16T20:06:40Z")

</div>

> [@dmr07](#):
>
> My endgoal is to compile it into a .exe file to share.  
> I’m new to Julia and coding in general

Be warned that this is quite an ambitious goal. You may find information in the several recent threads started by _uwestoehr_, who is pursuing similar objective, useful.

I’d suggest you first try to implement your Blink call in pure Julia, then try to call it from Python, to make it easier to localize the problem. Actually, why Python: What are planned next steps?

And - please read: [Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757)

---

<div class="post-metadata">

### Author: ![dmr07](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmr07/32/215759_2.png) [@dmr07](https://discourse.julialang.org/u/dmr07)
#### Post date: [April 16, 2025, 9:24pm UTC](https://discourse.julialang.org/t/blink-gui-closes-immediately-after-wait-w-when-launched-via-pyjulia/128138/4 "2025-04-16T21:24:48Z")

</div>

I tried it in just julia. I got the code to run but when I used PackageCompiler to make it into an exe, I ran into the issue of the window closing immediately after i opened the .exe. A friend suggested calling it from Python to see if that works. But the endgoal is a purely Julia executable.

---

<div class="post-metadata">

### Author: ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)
#### Post date: [April 17, 2025, 6:39am UTC](https://discourse.julialang.org/t/blink-gui-closes-immediately-after-wait-w-when-launched-via-pyjulia/128138/5 "2025-04-17T06:39:19Z")

</div>

Reading the code, I think `wait(w)` (where `w` is the `Window` you created) just wais until the the `Window` is initialized.  
So you will need some main-loop afterwards. I’d try adding this after `wait(w)`

```julia
while active(w)
    sleep(1000)
end

```

This checks every second, whether the window is still active, which means that it is still connected to the electron shell (?not sure if that is the correct terminology).

---

<div class="post-metadata">

### Author: ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)
#### Post date: [April 17, 2025, 9:37am UTC](https://discourse.julialang.org/t/blink-gui-closes-immediately-after-wait-w-when-launched-via-pyjulia/128138/6 "2025-04-17T09:37:35Z")

</div>

I may error, but I think if the compiled package just runs the `julia_main` function of your package, then the observed behavior is to be expected. The whole `Electron` machinery will be shut down as soon as the parent process exits.
