Right! That was going to be my question as well. The point is that you have to understand how the “runtime state” of the notebooks work: anytime you close and reopen the notebook or do any operation that restarts the Kernel, you need to rerun all the previous cells to create any variables or functions that are defined or imported in those cells. Anytime you get “routine name not defined”, try “Cell → Run All Above” and then try it again.
As you’ve discovered, running locally requires that you bring down all the files associated with each assignment, not just the notebook itself. There are not complete instructions for doing that, but here’s a thread that gives some guidance. One important thing to realize is that the article on the Coursera Help Center about downloading doesn’t really cover the way things work in these courses.
Then the next layer of issues is that you need to install the correct versions of all the python and other packages that the notebooks depend on. Here’s a thread which talks about that, but is (again) not a complete recipe.