I sense that I am doing something silly, but here is the issue:

Function getPropertyOfFile($a, $b, $c)
{
    $a.GetDetailsOf($b, $c)
}

If I pass $a, $b, $c variables that are appropriate to the function, it fails saying that

"Method invocation failed because [System.Object[]] doesn't contain a method named 'GetDetailsOf'."

However, if I directly replace $a, $b, $c with the arguments that I was passing, and then try to run that, it works fine.

What the heck is going on?

Note: I am using powershell ISE, and am inputting the function to powershell by copy/pasting it into the console. I have also been working under the assumption that if I input a new function with the same name, it would overwrite. Is there a better way to just have PS read from the .ps1?

Edit: I am trying to wrap the answer to this question into functions.

Edit 2:

Function getPropertyOfFile $a $b $c
{
    $a.GetDetailsOf($b, $c)
}

Gives an Missing function body in function declaration. At line:1 char:28 error.

Edit
Report