I have written a very large script that does different parts of a larger process.
Now I wanted to seperate these parts to different scripts so I moved each part of the logic to a different ps1 files.
I created: Basic_Functions.ps1 > this contains some functions I use in all the different parts Part1.ps1 > This is the first part of the script Part2.ps1 > The second part should just start after the first part ...
All Part* Scripts use functions defined in Basic_Functions.ps1.
I run the script from the task scheduler and to be sure that the different parts are running in the correct order I created a Runner.ps1 where the code is:
. ".\Basic_Functions.ps1"
. ".\Part1.ps1"
. ".\Part2.ps1"
But then I get an error from Part1.ps1 that the functions defined in Basic_Functions.ps1 do not exist.
When I simple start a PowerShell Session and do . ".\Basic_Functions.ps1" I can use the methods defined and everything works just fine.
Can someone point me into the right direction? Thank you.