Is there a way to access world files through python?

My intention: I am wanting to create python code that runs on my computer to be able to be able to give random items to the players. I want to be able to edit a journal of items they have with the code automatically.

What I have tried so far: I have looked through several posts, and I was not able to find a definitive answer on this.

Is there a way for me to access any files through this method?

While you can access your files, it wouldn’t allow you to do what you’re looking for, since the data used by Foundry is stored in a binary database (which is also locked by Foundry for its exclusive use).
It would make a lot more sense for you to write it as a macro within the game. I also think there might be existing modules that already do what you’re looking for.