Here is an example:
function ChildF()
{
#Creating new function dynamically
$DynFEx =
@"
function DynF()
{
"Hello DynF"
}
"@
Invoke-Expression $DynFEx
#Calling in ChildF scope Works
DynF
}
ChildF
#Calling in parent scope doesn't. It doesn't exist here
DynF
I was wondering whether you could define DynF in such a way that it is "visible" outside of ChildF.