# Is there a way to hot reload code from outside the oliveProgram block?

**URL:** <https://openrndr.discourse.group/t/is-there-a-way-to-hot-reload-code-from-outside-the-oliveprogram-block/178>\
**Category:** How to?\
**Created:** [December 19, 2020, 1:07pm UTC](https://openrndr.discourse.group/t/is-there-a-way-to-hot-reload-code-from-outside-the-oliveprogram-block/178 "2020-12-19T13:07:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rolodophone](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rolodophone](https://openrndr.discourse.group/u/rolodophone)\
**Post date:** [December 19, 2020, 1:07pm UTC](https://openrndr.discourse.group/t/is-there-a-way-to-hot-reload-code-from-outside-the-oliveprogram-block/178/1 "2020-12-19T13:07:44Z")

</div>

Is there a way to hot reload code from outside the oliveProgram block? For instance, hot reload a class in another file whenever I make changes to it.

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [December 23, 2020, 9:39am UTC](https://openrndr.discourse.group/t/is-there-a-way-to-hot-reload-code-from-outside-the-oliveprogram-block/178/2 "2020-12-23T09:39:58Z")

</div>

I think @ricardo has more experience with olive. Was it possible to reload classes? I vaguely remember currently it’s not.

---

<div class="post-metadata">

**Author:** ![rolodophone](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rolodophone](https://openrndr.discourse.group/u/rolodophone)\
**Post date:** [December 23, 2020, 4:16pm UTC](https://openrndr.discourse.group/t/is-there-a-way-to-hot-reload-code-from-outside-the-oliveprogram-block/178/3 "2020-12-23T16:16:11Z")

</div>

Okay, thanks for the info

---

<div class="post-metadata">

**Author:** ![ricardo](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/ricardo/32/8_2.png) [@ricardo](https://openrndr.discourse.group/u/ricardo)\
**Post date:** [December 25, 2020, 11:27am UTC](https://openrndr.discourse.group/t/is-there-a-way-to-hot-reload-code-from-outside-the-oliveprogram-block/178/4 "2020-12-25T11:27:06Z")

</div>

Unfortunately it’s not possible to reload external classes via Olive.

---

<div class="post-metadata">

**Author:** ![rolodophone](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rolodophone](https://openrndr.discourse.group/u/rolodophone)\
**Post date:** [December 25, 2020, 1:43pm UTC](https://openrndr.discourse.group/t/is-there-a-way-to-hot-reload-code-from-outside-the-oliveprogram-block/178/5 "2020-12-25T13:43:58Z")

</div>

Ok. Have a nice Christmas.

---

<div class="post-metadata">

**Author:** ![abe](https://yyz2.discourse-cdn.com/free1/user_avatar/openrndr.discourse.group/abe/32/700_2.png) [@abe](https://openrndr.discourse.group/u/abe)\
**Post date:** [December 26, 2020, 11:55am UTC](https://openrndr.discourse.group/t/is-there-a-way-to-hot-reload-code-from-outside-the-oliveprogram-block/178/6 "2020-12-26T11:55:24Z")

</div>

I haven’t tested with Olive, but in a normal OPENRNDR program the HotSwap option works for reloading classes without stopping the program.

I don’t know if these settings are required because I haven’t changed them in a very long time.

 ![2020-12-26-124831_900x700_scrot](https://global.discourse-cdn.com/free1/uploads/openrndr/original/1X/834a0d2a5c8e94879b893cbebc4735c457a4129d.png)

This is my main program:

```auto
package apps2.simpleTests

import org.openrndr.application
import org.openrndr.math.Polar

fun main() = application {
    program {

        val c = SimpleDrawingClass(drawer)
        var angle = 0.0

        extend {
            angle += 1.0
            drawer.run {
                drawer.translate(
                    drawer.bounds.center +
                            Polar(angle, 200.0).cartesian
                )
                c.draw()
            }
        }
    }
}

```

And this is the class I reload:

```auto
package apps2.simpleTests

import org.openrndr.color.ColorRGBa
import org.openrndr.draw.Drawer

class SimpleDrawingClass(val drawer: Drawer) {
    fun draw() {
        with(drawer) {
            strokeWeight = 8.0
            stroke = ColorRGBa.GREEN
            circle(0.0, 0.0, 100.0)
        }
    }
}

```

Then I **Debug** the main program, I make changes to `SimpleDrawingClass` and click the hammer icon on the top bar.

![2020-12-26-125342_237x39_scrot](https://global.discourse-cdn.com/free1/uploads/openrndr/original/1X/ea5493a16930f980e383f3ba0be9bb032a09c8c0.png)  
The circle does not suddenly jump, so the main class is not reloaded. But the `strokeWeight` or the `stroke` do change after clicking the hammer.
