# Old question: How to clear the custom function in Julia REPL?

**URL:** <https://discourse.julialang.org/t/old-question-how-to-clear-the-custom-function-in-julia-repl/77848>\
**Category:** General Usage\
**Created:** [March 14, 2022, 6:36am UTC](https://discourse.julialang.org/t/old-question-how-to-clear-the-custom-function-in-julia-repl/77848 "2022-03-14T06:36:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gangchern](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gangchern/32/13298_2.png) [@gangchern](https://discourse.julialang.org/u/gangchern)\
**Post date:** [March 14, 2022, 6:36am UTC](https://discourse.julialang.org/t/old-question-how-to-clear-the-custom-function-in-julia-repl/77848/1 "2022-03-14T06:36:52Z")

</div>

How do you remove a function you have created when working in the Julia REPL? Can this be done without restarting the session?  
This is an old question several years ago. I just want to check if there is new updates in Julia 1.7 on this point?

It is quite annoying to debug a function by keeping on restart the Julia REPL.

---

<div class="post-metadata">

**Author:** ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)\
**Post date:** [March 14, 2022, 8:09am UTC](https://discourse.julialang.org/t/old-question-how-to-clear-the-custom-function-in-julia-repl/77848/2 "2022-03-14T08:09:30Z")

</div>

Why do you need to remove the function?

If it is only about redefining methods it shouldn’t be any problem, new methods with the same type signature as a previously existing one it will just overwrite the previous ones.

---

<div class="post-metadata">

**Author:** ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)\
**Post date:** [March 14, 2022, 8:36am UTC](https://discourse.julialang.org/t/old-question-how-to-clear-the-custom-function-in-julia-repl/77848/3 "2022-03-14T08:36:23Z")

</div>

Its best to use Revise.jl for this. Put your function in a file then run `using Revise; Revise.includet("thatfile.jl")`, or put it in a package in which case just `using Revise, YourPackage`. Then edit the source file and Revise will live-update changes to it into your running session, including deleting a method if you delete it / comment it inside the source.

In a pinch you can technically also do this by hand using `Base.delete_method` but its not nearly as user friendly.

---

<div class="post-metadata">

**Author:** ![gangchern](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gangchern/32/13298_2.png) [@gangchern](https://discourse.julialang.org/u/gangchern)\
**Post date:** [March 14, 2022, 2:05pm UTC](https://discourse.julialang.org/t/old-question-how-to-clear-the-custom-function-in-julia-repl/77848/4 "2022-03-14T14:05:09Z")

</div>

The overwrite seems only happens after successfully compiled. When I try to write some complex functions, I usually generate many errors, especially for multiple dispatch functions of multi-variables. I usually get lost on the debug after several errors. It seems Julia REPL also get lost. It will quite helpful if I can clear “function()” without restarting.

---

<div class="post-metadata">

**Author:** ![gangchern](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gangchern/32/13298_2.png) [@gangchern](https://discourse.julialang.org/u/gangchern)\
**Post date:** [March 14, 2022, 2:09pm UTC](https://discourse.julialang.org/t/old-question-how-to-clear-the-custom-function-in-julia-repl/77848/5 "2022-03-14T14:09:10Z")

</div>

Good to know Revise.jl .It is very interesting and looks helpful. Although I still fails after tried several times.  
Do you know if Julia and/or vscode will add “Revise.jl” into its standard package in future?

---

<div class="post-metadata">

**Author:** ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)\
**Post date:** [March 22, 2022, 2:39pm UTC](https://discourse.julialang.org/t/old-question-how-to-clear-the-custom-function-in-julia-repl/77848/6 "2022-03-22T14:39:44Z")

</div>

Maybe `Base.delete_method` is what you want?

Some similar discussion here

> [@Deleting methods in julia](https://discourse.julialang.org/t/deleting-methods-in-julia/13455):
>
> Hi all, I am a relative newcomer to this version of Julia, so sorry for the (maybe) obvious question. I have the problem, that I define multiple methods of a function in an interactive session (IJulia to be precise) in Julia v1.0.0 and I would like to delete some of those methods. Is there any way to do that without restarting the session (or the kernel in this case)? Thanks, Maxi
