The OpenForm method has a parameter, defining in which window to open it.
Global context.OpenForm
Syntax:
OpenForm(<Fo rmName>, <Parameters>, <Owner>, <Unique>, <Window>)
…
Note the last two parameters:
<Unique> (optional)
Type: Arbitrary.
This parameter can be used to set a key with a value that will be used for searching forms that have already been opened. If a form has the same uniqueness key, the found form will be activated instead of a new form being opened.
If the value is False, the system will look for a form with a default uniqueness key, and if the value is True, there will be no search for a form. Any other value specifies the uniqueness key on which the search will be performed.
Default value: False
<Window> (optional)
Type: ClientApplicationWindow;WindowOpenVariant.
The application window in which the form will be opened.
Applicable for managed forms only. The window should be either the main application window or the form's auxiliary window.