In my code I loop over an array dir, however the code does not work when I loop over it when it is a function input. Iny my more complicated function I have narrowed down th