When I pass a list to another method, it returns NoneType. How can I fix this? : <p>I am trying to write a <code>main()</code> method that will call another method that reads the individual records within a .txt file; this is the <code>loadFile()</code> method. I've tested that the <code>loadFile()</code> method works and that the list it returns is ListType. However, when I call <code>loadFile()</code> within <code>main()</code> and try to act upon the list generated, I get an error like <code>TypeError: 'NoneType' object is not subscriptable</code>. Can someone help me ensure that the list I'm passing from one method to the next remains ListType? </p>

<pre><code>def loadFile(fileName):
    openFile = open(fileName, 'r')
    records = openFile.readlines()
    recordList = []
    for item in records:
        recordList.append(item.rstrip('\n'))
    print(recordList)
    openFile.close()

def main():
    nameFile = 'names.txt'
    names = loadFile(nameFile)
    print(names[12])

main()
</code></pre>
