# Clear debug window by code

**URL:** https://discourse.nodered.org/t/clear-debug-window-by-code/28243
**Category:** General
**Created:** [12 June 2020 16:51 UTC](https://discourse.nodered.org/t/clear-debug-window-by-code/28243 "2020-06-12T16:51:52Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![crester](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crester/32/21997_2.png) [@crester](https://discourse.nodered.org/u/crester)
#### Post date: [12 June 2020 16:51 UTC](https://discourse.nodered.org/t/clear-debug-window-by-code/28243/1 "2020-06-12T16:51:52Z")

</div>

Hello  
is there a method to clear the debug window by code?  
Thank yoy  
KR

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [12 June 2020 17:01 UTC](https://discourse.nodered.org/t/clear-debug-window-by-code/28243/2 "2020-06-12T17:01:04Z")

</div>

Within the editor you can do:

```auto
RED.actions.invoke("core:clear-debug-messages")

```

But why do you want to do that via code? Node's should _not_ take it upon themselves to clear the debug sidebar.

---

<div class="post-metadata">

### Author: ![crester](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/crester/32/21997_2.png) [@crester](https://discourse.nodered.org/u/crester)
#### Post date: [12 June 2020 17:20 UTC](https://discourse.nodered.org/t/clear-debug-window-by-code/28243/3 "2020-06-12T17:20:50Z")

</div>

it gives me thie error:  
"TypeError: Cannot read property 'invoke' of undefined"

I want to clear the debug window in certain cases I have few debug objects but i want to focus in one and clear the window in a function before this one

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [12 June 2020 17:36 UTC](https://discourse.nodered.org/t/clear-debug-window-by-code/28243/4 "2020-06-12T17:36:24Z")

</div>

Ah you want to do this in a flow?

You can't. The code I provided is how you do it in the editor. Flows don't have any access to the editor.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [26 June 2020 17:36 UTC](https://discourse.nodered.org/t/clear-debug-window-by-code/28243/5 "2020-06-26T17:36:30Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
