Programmatically hide panel

please use search before posting to see relevant discussions.

TL;DR : No, not at this moment.

There is no mechanism in UXP to close a plugin’s panel. (You can show panels in PS prerelease, but not hide them programmatically).

Instead of hiding, render some UI to the user that explains what the issue is, and what they can do to rectify the issue. Otherwise the user may wonder why the plugin isn’t working as expected – which can lead to increased support requirements.

source and discussion here.