Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8091253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:00:20+00:00 2026-06-05T20:00:20+00:00

I would like to use the following class across multiple modules without needing log

  • 0

I would like to use the following class across multiple modules without needing log = InitLog() in every module. I need to be able to use ONE defined class variable (in this example log) across multiple modules. What is the best way to do this without altering my current code too drastically. Thanks

import os
import sys
import pdb
import fileinput
import Tools


class InitLog:
    def __init__(self):
        pass
    def setLaws(self):
        self.sound = 'off'
        self.engine = 'goo.txt'

    def Update(self):
        while Tools.Locked.State.LogAddress == True: pass
        Tools.Locked.State.LogAddress = True
        try: os.remove(path + '/' + self.dest + '/init.log')
        except: pass

        summery = 'sound: ' + self.sound + '\n'
        summery += 'engine: ' + self.engine + '\n'

        path = os.getcwd()
        if not os.path.exists(self.dest): os.makedirs(self.dest)
        if os.path.isfile(path + '/' + self.dest + '/init.log') == True: os.remove(path + '/' + self.dest + '/init.log')
        with open (path + '/' + self.dest + '/init.log', mode='a', encoding='utf-8') as a_file:
            a_file.write(summery)
        Tools.Locked.State.LogAddress = False


Tools.Locked.State.LogAddress = False
log = InitLog()
log.setLaws()
log.sound = 'on'
log.Update()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:00:21+00:00Added an answer on June 5, 2026 at 8:00 pm

    Create a module called logging which contains log. In other modules use from logging import log.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to use NHibernate Automapper to map the following class: public class
I would like to use following sql to avoid constructing sql dynamically: SELECT CommentID,
I'm writing my Servlet application and would like to use the following static method
I would like to use KVO in the following context: 1) In touchesBegan:withEvent: I
I would like to use something like the following: SELECT city FROM cities WHERE
I would like to know if I can use the following JQuery function on
I would like to use some iteration control flow to simplify the following LaTeX
I would like to use the data you get when calling the following URL
I would like to know if it is safe to use the following code
I'm using the following code successfully with HTTP but I would like to use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.