It happens because when you create a file it automatically assigns the working directory to it’s configuration, which of course is the one where you created it.
You can change that by going into Run -> Edit Configurations
. Click on the folder icon in Script path:
and correct the path to the file. Click OK
to save and you should be able to Run
the file again.