I’m going to have two class functions. The first class function opens the file. Then it calls a second function that writes to the file and recursively calls itself. When the second function finishes, the original function closes the file.
Is it possible to do this?
Sure, as long as you pass the file handle/object to the recursive function: