I have a script called foo.R that includes another script other.R, which is in the same directory:
#!/usr/bin/env Rscript
message(\
If rather than the script, foo.R, knowing its path location, if you can change your code to always reference all source'd paths from a common root then these may be a great help:
Given
/app/deeply/nested/foo.R/app/other.RThis will work
#!/usr/bin/env Rscript
library(here)
source(here("other.R"))
See https://rprojroot.r-lib.org/ for how to define project roots.