Public/Show-TablechartUI_STA.ps1

function Show-TablechartUI_STA {
    [CmdletBinding()]
    param(
        [Parameter(ValueFromPipeline=$true)] $InputObject,
        [string]$Title = "Grid + Charts"
    )
    if ($host.Runspace.ApartmentState -ne "STA") {
        # Relaunch current PowerShell with -STA and run the function
        $argsList = @(
            "-NoProfile","-STA","-Command",
            "Import-Module `"$PSScriptRoot\..\MeeluReportTools.psd1`" -Force; `$input = @(); `$input += @($input); Show-TablechartUI -Title `"$Title`" -InputObject `$input"
        )
        # Start a new process and pass the pipeline data (for simplicity, we reopen without pipeline here)
        Start-Process -FilePath (Get-Process -Id $PID).Path -ArgumentList $argsList
        return
    }
    Show-TablechartUI @PSBoundParameters
}