I fixed this btw. I just split the first element of the list if the length is 1. This seems to make it work for single or mutiple files.
There were several other errors in that the variable named "object_id" kept getting overwritten by the multirow. I used a unique name to solve that.