'does we have to add database connceting codes in every cog?

cluster = MongoClient("link")
databse = cluster["aditya"]
Arson = databse["Economy-db"]

we all know that we use this code To connect to the database but my question is let's see I am using cogs, I added this in my Warn command cog, and now I need to fetch warn from the database in another cog , do I have to add a similar code in every cog where I am bound to bring data from this database?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source