When you do
str(object), what you get is the runtime ID of that object. So that one can totally change between two executions, or even be re-used by another object after it is destroyed.
In order to be able to identify an object from a file you saved earlier, you have to give it a unique name, or ID of some sort, so that you can rebuild references when you read it from the file. It is up to you to decide how to do it.
Of course, reducing interconnection between your scripts can help making this task easier.
However, I read this:
Someone please teach me how to pass data between scripts during gameplay.
I might be wrong regarding the context of your post, but the answer to that specific question has been answered several times, and you don't need a file to do that: https://godotengine.org/qa/search?q=variable+from+another+scene