The fetch functions provided in nilearn’s datasets return a dictionary that has file paths to the downloaded data, which are stored by default in nilearn_data in your home directory. These functions are convenient for downloading data, but don’t have anything special about them that is required by nilearn.
If you wanted something similar to the dictionary that these functions return, you would have to build your own for your own dataset.
For instance, if you had a BIDS dataset stored in ~/my_data/, you could use python’s glob module to return all files that match a pattern:
You could imagine adding more keys to the dictionary depending if you needed them for the analysis.
Alternatively, you could look into PyBIDS, which provides various functions that allow you to access your data without having to provide all sorts of file paths (assuming your data is perfectly in BIDS format)