[Solved] Make addon open a popup if X is true

During one of its functions, my addon checks if a certain condition is true, and if so then I would like it to open a popup where the player can then set certain parameters and click a button to continue the process.

All example code I’ve been able to find explains how to simply open popups on the click of a button in the UI, but how do I do what I explained above?

Figured it out myself. I created a new operator for the popup and just ran that whenever needed. Just going over the code and cleaning it up helped a lot.