Cmdlet causes script freeze only when run from a GUI script

Hi, I am looking to under the differences when running cmdlet from a plain console window and from a script that first creates a GUI and then run the cmdlet on a button click.

I am working with PowerShell module for AdminStudio Application from Flexera. I got into a strange issue with couple of cmdlet from the module. Two of the cmdlet work well when executed from the prompt in a powershell console or a script that opens a console and run the command. However, when the same cmdlets are run from a script with GUI, the command executes succesfully as it does the expected action in the backend, but the script execution gets stuck and seem like the command fails to return successfully. One of the cmdlet returns a string object and other returns a custom object defined by the module. At the same time, there are other commands from the same module that has no issue executing from the same scripts.

I am checking on this with the support team for the concerned application and module, however, also trying to find some additional technical information on what is the difference in running a command from simple console and a GUI script, if any!

Thanks in advance