Sometimes a message shows that a function could not be found

This happens sometimes and I cannot figure it out. Happened on all versions of UD I tried, currently I am on UD 2.9 at the moment, hosted on Windows 2012R2 with PowerShell 5.1


Name Value

PSVersion 5.1.14409.1005
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
BuildVersion 10.0.14409.1005
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3

At times I get the following message (taken from the UD log file):

The term ‘GenerateNewOHCNumber’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again

The way the dashboard is structured is as follows:
Dashboard defines side nav and items route to a page ps1
The pages do a dot source the appropriate code ps1 to have flexible source editing capabilities without having to restart the dashboard after I made an edit
In the page code ps1 I have a New-UDCard defined with the visuals, one being a button to generate a number.
The button has a OnClick section where the function GenerateNewOHCNumber is called.

I have tried to place that function on the top as well as the bottom of the page code ps1, does not make a difference.

If I do a page refresh (F5) then in all probability the issue is gone.
But it will return at times, making it unpredictable and a bit annoying to the users using the dashboard.

Does this sound familiar to anyone and is there perhaps a solution to this?

Picture with the message: