the singleton pattern we can now import specific class from python file by telling the interpreter which file we want to useand then what class it should import importing from different packages can get more complex than thisbut for now just realizing that you can import the specific class you want to use is enough packages are groups of python files that live in the same folder on your computer and provide similar or related functions to create new logger using the logger blueprint (class)we simply use name for the logger and set that equal to the class nameand then we pass in any parameters needed by the __init__ function after instantiating the loggerwe can simply use the object name with the relevant log function to write the log message to the correct file running new_script_with_logger py will result in the following message in the /var/log/class_logger log file[infothis is an info message cleaning it up nowyou probably do not want to write to unique log file for every part of your project that needs to write some log messages sowhat you want is some way to get the same logger that you already created if there is oneor create new logger if none already exist you want to keep the benefits of object-oriented programming while taking control of the object-creation process out of the hands of the programmer using the logger we do that by taking control of the process by which the logger object is created consider the following way of taking control of the processsingleton_object py class singletonobject(object)class __singletonobject()def __init__(self)self val none def __str__(self)return "{ ! { }format(selfself valthe rest of the class definition will follow hereas per the previous logging script instance none