[MAYA][pymel] Dialog that returns value

I have few custom dialogs written in Pymel, for example:
I have project management UI which opens Publish file dialog (custom) and I wan’t to know when Publish file dialog ended,
so my project management UI can get refeshed.

Any ideas how could I make this work?

Similar to how confirmDialog or prompDialog works

Or maybe another technique :slight_smile:

Thanks for input

I think what you are asking for is called a “modal dialog”. Autodesk Maya Online Help

Yep, LayoutDialog is the way to do this. It’s a bit confusing to use – pass it a function that create your UI (you have to start your UI creation by getting the current UI parent – the examples in the mel docs show how it works. Your UI will be shown in the window. To close the dialog you issue 'layoutDialog(dismiss="<some string>") from a button or other handler – this closes the window and returns <some string> to the original calling function as a result. It’s clunky, but it works.

Be warned you can’t do more than one modal at a time this way, and a hang in your dialog may make it impossible to get back to maya.

In general, modal UI is something to avoid where possible – in a case like this, maybe you can use the standard file dialog off a button to choose the files, but keep the custom UI in a non-modal window for better integration with the rest of the UI