On Windows, you won't be able to replace the EXE and PCK file while the project is running due to Windows' file locking limitations. However, you should be able to move those files to %TEMP%
where these files can be cleaned automatically by the Disk Cleaner program when the user runs low on disk space.
You can get the path to Windows' temporary data folder using OS.get_environment("TEMP")
.
PS: Implementing self-update is a complex process with security implications (such as ensuring the use of secure connections and signing releases). Consider using Steam or itch.io to handle this instead, rather than implementing your own self-update solution which may contain security holes.