Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Imports in my first package
#2
Can look this post for some examples.
See in this example how top level __init__.py is used to lift sub-modules and bind package together.
This mean that can have simple import import my_makehtml now have attribute access to all in package.

A good example in of this Requests see that import is simple import requests and you have attribute access to all useful stuff in package.
Here a example where import could be simpler for users.
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
cuppajoeman Wrote:from numuse.converters import *
Never use import * at all,it's always bad.
Reply


Messages In This Thread
Imports in my first package - by cuppajoeman - Jun-27-2021, 11:36 PM
RE: Imports in my first package - by snippsat - Jun-28-2021, 09:06 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Imports that work with Python 3.8 fail with 3.9 and 3.10 4slam 1 2,596 Mar-11-2022, 01:50 PM
Last Post: snippsat
  script with imports works but pytest gives "ModuleNotFoundError"? Hpao 0 1,571 Jun-27-2021, 08:30 PM
Last Post: Hpao
  Help wanted with python imports petros21 3 2,560 Apr-07-2021, 07:16 PM
Last Post: snippsat
Question How to include Modules not found (conditional imports) in my setup.py when I want to cff 0 3,826 Mar-17-2021, 11:57 AM
Last Post: cff
  threading across imports Nickd12 2 2,146 Nov-09-2020, 01:59 AM
Last Post: Nickd12
  refreshing imports seandepagnier 4 2,741 Sep-20-2020, 11:51 PM
Last Post: seandepagnier
  Multimode imports fine as script but not after compiling into exe chesschaser 0 2,415 Aug-13-2020, 01:28 PM
Last Post: chesschaser
  absolute imports between folders mikisDW 0 1,539 Aug-05-2020, 12:26 PM
Last Post: mikisDW
  Understanding the concept ( Modules , imports ) erfanakbari1 1 2,195 Nov-25-2019, 01:59 AM
Last Post: Larz60+
  How Do I Get the IDE to Find My Imports petec 18 9,227 Feb-24-2019, 02:50 AM
Last Post: petec

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020