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

  • Home
  • SEARCH
  • 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 6071813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:05:25+00:00 2026-05-23T10:05:25+00:00

I am trying to build a software package that fixes arbitrary data inconsistencies in

  • 0

I am trying to build a software package that fixes arbitrary data inconsistencies in one of my databases. My design includes two classes – Problem and Fix.

The problems are SQL queries stored as .cfg files (e.g. problem_001.cfg), and the fixers are stored as Python files (e.g. fix_001.py). The query config file has a reference to the Python file name. Each fixer has a single class Fix, which inherits from a base class BaseFix.

`-- problems
    |-- problem_100.cfg
    |-- problem_200.cfg
    |-- problem_300.cfg
    `-- ...
`-- fixer
    |-- __init__.py
    |   |-- fixers
    |   |   |-- fix_100.py
    |   |   |-- fix_200.py
    |   |   |-- fix_300.py
    |   |   |-- ...
    |   `-- ...
    `-- ...

I would like to instantiate Problem files and supply them with Fix objects in a clean way. Is there a way to do it without keepping all the fixers in the same file?

UPDATE:

This is the final code that worked (thanks, @Space_C0wb0y):

    fixer_name='fix_100'
    self.fixer=__import__('fixer.fixers', globals(), locals(), 
                 [fixer_name]).__dict__[fixer_name].Fix() 
  • 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-05-23T10:05:25+00:00Added an answer on May 23, 2026 at 10:05 am

    You can dynamically import modules using the builtin __import__, which takes the module-name as string-argument (see here). The modules do have to be in the module search path.

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

Sidebar

Related Questions

I am trying to build an Eclipse application that would work with a linux/motif
I'm trying to write a python script that packages our software. This script needs
I'm trying to setup a software package with GNU autotools and would like for
I'm trying to build a Chrome browser extension, that should enhance the way the
I am trying to build some software on a brand new install of CentOS
I am trying to build a maven project to test out some testing software
Trying to build a GUI application in Java/Swing. I'm mainly used to painting GUIs
I trying to build and compile my xcodeproj in command line and it is
I'm trying to build a grammar with the following: NUMERIC: INTEGER | FLOAT |
I'm currently trying to build a personal website to create a presence on the

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.