Improvement to imports, what is a better way ?
Dan Kolis
dankolis at gmail.com
Wed Jan 18 13:43:54 EST 2023
This program has lots of files and each is well segregated for a concept.
the top of each as a heap of imports, all identical. Well the very top has some one of's
import os as os
import sys as sys
import importlib as importlib
import datetime as dt
from tokenize import maybe
import signal
from tkinter import filedialog as fd
from tkinter.messagebox import showinfo
import tkinter as tk
from tkinter import ttk
from tkinter import font
from PIL import Image as pl
from PIL import ImageTk as ii
# Imports part of this program
import aboutTime as tt # Time dates timestamps and the like
import avMedia as av # Audio and maybe video 'someday' well definitely lots of TTS text to speech
import basicSwitchboard as sc # First switchboard lurking. Kickoff to sequence viewers
import bestNotifications as bn # Alerts, modals and notifications of many kinds including TK windows
import bitBlitting as bb # Help - # A setup window with basic facts written into files and the workspace
import configSetting as cs # A setup window with basic facts written into files and the workspace
import devPeeks as dp # Developments peek assets code for adding features and debugging
import fileIo as io # File reads, writes even some of the the pickle and unpickling
import forFun as ff # Staging area for uncertian features, also some dynamic code inclusion
import fractionScreens as fs # Common window pieces for TK windows in sequence viewers
import genomeDb as gd # IO to from databases external files gbk and others sure
import globalIdeas as gi # Common code for stuff used everywhere and definition of share DOT OBJECTS
import insertableEditors as ie # Text editor(s) and support for that, some language issues managed too
import modalSimple as mo # Modal windows icp seq ssues, not used much currently
import osDependant as od # Operating system dependant calls and adaptions
import pickle as pk # Packaging to and from file system for objects especially DOT OBJECTS
import screenBuilder1 as sb # Screen maker for TKinter and TKinter ++ windows
import selectViewer as sv # Window for picking which sequence viewers are enabled
import sequencesMaintain as sm # Touching up temporal version issues of DOT OBJECTS
import sequencesOverview as so # Working with sequences as macro facts, lists, see turn off etc
import serverHttp1 as sh1 # Servers for HTTP - User Support
import serverHttp2 as sh2 # Servers for HTTP - Protein viewing
import specialFour as sf # Classes and stuff for viewer four, a very complex viewer
import stagingNow as sn # More stabler new ideas getting tried out and moved in
import taskingFunction as tf # Tasker for real timeish event processor calls. Has two versions both work
import toastMaker as tm # Notifications
import transFormations as xf # Sequence transFormations from mother natures ideas like DNA and RNA
import unlovedMenus as um # Pretty rarely used ond fashioned menus. A while interface is in here that works
import wayOffline as wo # Code not discarded but just studies, etc
import windowsX as wx # Windows Life ! X11 esp TK not MS Windoze ...
So the file for instance fileIo.py has a duplicate of this.
I want to be able to call any code by using the two char prefix form anywhere. ex: io.get_Sequence( 'abc.fa' )
this seems weirdly disorderly. when it starts it sort of iterates down into objects, backs up etc.
What's the right way to do this ?
Thank you
Dan
More information about the Python-list
mailing list