# Can I access toolbar instance from other code in its plugin?

**URL:** https://discourse.paraview.org/t/can-i-access-toolbar-instance-from-other-code-in-its-plugin/4222
**Category:** ParaView Support
**Created:** [April 29, 2020, 5:00pm UTC](https://discourse.paraview.org/t/can-i-access-toolbar-instance-from-other-code-in-its-plugin/4222 "2020-04-29T17:00:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![johnt](https://discourse.paraview.org/user_avatar/discourse.paraview.org/johnt/32/3645_2.png) [@johnt](https://discourse.paraview.org/u/johnt)
#### Post date: [April 29, 2020, 5:00pm UTC](https://discourse.paraview.org/t/can-i-access-toolbar-instance-from-other-code-in-its-plugin/4222/1 "2020-04-29T17:00:35Z")

</div>

I have a plugin that creates a toolbar using the cmake function paraview\_plugin\_add\_toolbar(). Is there a way that other code in my plugin can access and call methods on the toolbar instance that gets created by paraview?

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [April 29, 2020, 5:27pm UTC](https://discourse.paraview.org/t/can-i-access-toolbar-instance-from-other-code-in-its-plugin/4222/2 "2020-04-29T17:27:24Z")

</div>

Qt has API to get access to the `QMainWindow` instances in the application and then you can get access to QToolBar instances in each of those windows.

see `pqCoreUtilities::findMainWindow`, `pqCoreUtilities::mainWidget` for how to access the main window.

---

<div class="post-metadata">

### Author: ![johnt](https://discourse.paraview.org/user_avatar/discourse.paraview.org/johnt/32/3645_2.png) [@johnt](https://discourse.paraview.org/u/johnt)
#### Post date: [April 29, 2020, 7:06pm UTC](https://discourse.paraview.org/t/can-i-access-toolbar-instance-from-other-code-in-its-plugin/4222/3 "2020-04-29T19:06:15Z")

</div>

Gotcha, thanks.
