Is it possible to provide access to only specific file of a repo to developer

So, I have a private repo and a developer to work on certain scripts of the repo. Is it possible to let them access only the files they need to work on while restricting access to other files in that repo. I know it sounds weird but it’s what I need.

You can’t hide part of the repository contents to collaborators. What you can do, if you have the right GitHub plan, is to enforce code ownership so that certain files might not be edited except by their owners: