BOM-Window fails to add entities with Add-BomWindowEntity in non modal state

BOM-Window fails to add entities, like to be removed bom rows, when run with the -NoWait switch

Description

When the BOM-Window is run non modally with the -NoWait switch then the Add-BomWindowEntity cmdlet fails to add any new entities.

The log will show something like this

2025-10-17 16:23:42,865 [54] WARN powerGate.UI.Cmdlets.Modules.UiModule - UiModule.Load({ContainerBuilder}) | Failed: exception = {System.InvalidOperationException}.
System.InvalidOperationException: No BOM Window is currently open! Please run the Show-BOMWindow command and try again.
at powerGate.UI.Cmdlets.Modules.UiModule.Load(ContainerBuilder builder)

Cause

This is an issue currently under investigation. This only happens when the code is defined in a .psm1 file.

Solution

To get around this issue make sure that your BOM-Window functions and functions used in them are defined in a .ps1 file.