# Dash.jl and interactive REPL?

**URL:** <https://discourse.julialang.org/t/dash-jl-and-interactive-repl/66197>\
**Category:** General Usage\
**Tags:** dash\
**Created:** [August 11, 2021, 12:36pm UTC](https://discourse.julialang.org/t/dash-jl-and-interactive-repl/66197 "2021-08-11T12:36:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Post date:** [August 11, 2021, 12:36pm UTC](https://discourse.julialang.org/t/dash-jl-and-interactive-repl/66197/1 "2021-08-11T12:36:28Z")

</div>

Is there a way to have a [Dash.jl](https://github.com/plotly/Dash.jl) application running while at the same time being able to use the REPL interactively?

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [August 11, 2021, 12:42pm UTC](https://discourse.julialang.org/t/dash-jl-and-interactive-repl/66197/2 "2021-08-11T12:42:54Z")

</div>

Very stupid reply from me. HAve you looked at Pluto notebooks?

---

<div class="post-metadata">

**Author:** ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Post date:** [August 11, 2021, 12:48pm UTC](https://discourse.julialang.org/t/dash-jl-and-interactive-repl/66197/3 "2021-08-11T12:48:23Z")

</div>

Thank you for the suggestion. I have no experience with Pluto. Can one mix buttons and PlotlyJs graphs?

---

<div class="post-metadata">

**Author:** ![c42f](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c42f/32/52842_2.png) [@c42f](https://discourse.julialang.org/u/c42f)\
**Post date:** [August 11, 2021, 12:53pm UTC](https://discourse.julialang.org/t/dash-jl-and-interactive-repl/66197/4 "2021-08-11T12:53:34Z")

</div>

Is your problem that Dash’s `run_server` function blocks the REPL which you start it from?

In that case it should be as simple as adding an `@async`

```julia
@async run_server(app, "0.0.0.0", 8080)

```

---

<div class="post-metadata">

**Author:** ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Post date:** [August 11, 2021, 1:01pm UTC](https://discourse.julialang.org/t/dash-jl-and-interactive-repl/66197/5 "2021-08-11T13:01:50Z")

</div>

This is what I tried already and got the following warning.

```julia
julia> @async run_server(app, "0.0.0.0", debug=true)
┌ Warning: Hot reloading is disabled for interactive sessions. Please run your app using julia from the command line to take advantage of this feature.
└ @ Dash C:\Users\michele.zaffalon\.julia\packages\Dash\66VCI\src\server.jl:60
Task (runnable) @0x0000000057e64650[ Info: Listening on: 0.0.0.0:8050

```

I thought I was not using the command correctly, but now that I re-read it, I see that only the hot reloading of the Dash application is disabled.

---

<div class="post-metadata">

**Author:** ![gbaraldi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gbaraldi/32/22101_2.png) [@gbaraldi](https://discourse.julialang.org/u/gbaraldi)\
**Post date:** [August 11, 2021, 2:21pm UTC](https://discourse.julialang.org/t/dash-jl-and-interactive-repl/66197/6 "2021-08-11T14:21:11Z")

</div>

You can, do you want it for yourself or you want to distribute it?

---

<div class="post-metadata">

**Author:** ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Post date:** [August 11, 2021, 2:35pm UTC](https://discourse.julialang.org/t/dash-jl-and-interactive-repl/66197/8 "2021-08-11T14:35:48Z")

</div>

It is a control tool for hardware that has a long intrinsic time constant. My worry is that if I start and I get a parameter wrong, I wouldn’t be able to inspect its status.

---

<div class="post-metadata">

**Author:** ![etpinard](https://avatars.discourse-cdn.com/v4/letter/e/45deac/32.png) [@etpinard](https://discourse.julialang.org/u/etpinard)\
**Post date:** [November 17, 2021, 6:32pm UTC](https://discourse.julialang.org/t/dash-jl-and-interactive-repl/66197/9 "2021-11-17T18:32:27Z")

</div>

The current `debug=false` Dash.jl dev mode works great, but having to run it outside the REPL means we can’t use [`Infiltrator.jl`](https://github.com/JuliaDebug/Infiltrator.jl) among other things.

So, starting from

```nohighlight
# e.g. in MyDashApp/src/MyDashApp.jl
module MyDashApp

using Dash

function makeapp()
  app = dash()
  app.layout = #= =#
  callback!(app, #= =#)
  # ...
  return app
end

end # module

```

I was able to get something working with

```nohighlight
# watch.jl
using Revise
using Dash, Dash.HTTP, Dash.Sockets
using MyDashApp

const host = "127.0.0.1"
const port = 9002

# mostly taken from
# https://github.com/plotly/Dash.jl/blob/bba2bcb8765935d5aa86660992edf275b163a741/src/server.jl#L52-L57
function start_server(app)
    handler = Dash.make_handler(app)
    server = Sockets.listen(Dash.get_inetaddr(host, port))
    task = @async HTTP.serve(handler, host, port; server, verbose=true)
    return server, task
end

function watch()
    function go()
        app = MyDashApp.makeapp()
        Dash.enable_dev_tools!(app, debug=true)
        return start_server(app)[1]
    end

    server = go()
    Revise.entr([], [MyDashApp]; postpone=true) do
        close(server)
        server = go()
    end
end

```

then

```nohighlight
julia> include("watch.jl"); @async watch()

```

appears to work.
