Python generated warning to purge model being hidden behind Dynamo player

Hi all,

Was hoping some light could be shed on a the layered order of a Microsoft form generated at the end of the running of a Dynamo script.

The script performs a model strip to prepare the file for issuing. But since it is not possible to Purge a model using Dynamo, I am generating a warning to users reminding them to purge the model.

The form is performing as expected, but the problem is if there are any other windows open in front of Revit (such as Dynamo player where most users will be running this script from) it is hidden behind it and looks like the script hasn’t finished running. When in reality it’s simply looking for the user to press the ‘ok’ button on the hidden form.

I believe it is something to do with the ordering of the windows, but can’t seem to find anything online in regards to changing this.

Please see the code below (not sure how to format a copy of the code as is so had to replace tabs with spaces, this might need checking if it is copied & pasted).

Thanks in advance.

import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Drawing")
from System.Windows.Forms import Application, Form, Label, Button
from System.Drawing import Size, Point, Font 
class IForm(Form):

    def __init__(self):
	
	font = Font("^""Arial", 15)
	font1 = Font("Arial", 10)
	
	self.Text = 'WARNING'
	self.Width = 400
	self.Height = 170
	self.CenterToScreen()
	self.Font = font
	
	label = Label()
	label.Text = "\n".join(IN[0])
	label.Width = 380
	label.Height = 160
	label.Parent = self	
	 
	btn = Button()
	btn.Parent = label
	btn.Text = "Ok"
	btn.Location = Point(160, 90)
	btn.Click += self.OnClick
	btn.Font = font1
	btn.Width = 50
	btn.Height = 25

 def OnClick(self, sender, args):
	self.Close()

Application.Run(IForm())

You might want to look into the Orchid package. Pretty sure @erfajo has solved this there.