This is probably a very basic question.
I have some objects that I want to be created once and then used by many classes of my application, for instance "logging" and "db". I don't wanna make a new connection to the DB everytime a different class wants to do something.
So my idea was to create a Class like:
class MyDB(object):
mydb=createMySQLconnection()
then I'd do "from ... import MyDB" and use MyDB.mydb
would it work? is this the best way to do that?