I had my sqlalchemy related code in my main() method in my script.
But then when I created a function, I wasn't able to reference my 'products' mapper because it was in the main() method.
Should I be putting the sqlalchemy related code (session, mapper, and classes) in global scope so all functions in my single file script can refer to it?
I was told a script is usually layout out as:
globals functions classes main
But if I put sqlalchemy at the top to make it global, I have to move my classes to the top also.