I was able to refactor this and include other python files to make it more manageable. I had written several scripts that were doing the same thing with small differences. Instead of re-typing code, I used python’s import function and put most of the repeating routines into a separate .py file that I could import.