Answer:
You can't call a function unless you've already defined it. Move the def createDirs(): block up to the top of your file, below the imports.
Step-by-step explanation:
Some languages allow you to use functions before defining them. For example, javascript calls this "hoisting". But Python is not one of those languages.