Python Forum
Importing issues with base class for inheritance
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Importing issues with base class for inheritance
#3
(May-19-2021, 02:55 PM)Gribouillis Wrote: You could import pricing prior to item_pricing in init.py
# pricing/__init__.py
from .pricing import Pricing
from .item_pricing import ItemPricing
then in the item_pricing.py file
# pricing/item_pricing.py
from . import Pricing

class ItemPricing(Pricing):
    ....
I cannot answer about TYPE_CHECKING because I don't use it. The very word looks antipythonic to me.

Id tried and it works. Why does this work though?
Reply


Messages In This Thread
RE: Importing issues with base class for inheritance - by riccardoob - May-19-2021, 03:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  super() and order of running method in class inheritance akbarza 7 1,025 Feb-04-2024, 09:35 AM
Last Post: Gribouillis
  Some help with my first python class and importing ....im making a lidar program jttolleson 7 1,480 Jul-28-2023, 08:34 AM
Last Post: jttolleson
  My code displays too much output when importing class from a module lil_e 4 1,365 Oct-22-2022, 12:56 AM
Last Post: Larz60+
  Child class inheritance issue eakanathan 3 1,508 Apr-21-2022, 12:03 PM
Last Post: deanhystad
  Calling a base class variable from an inherited class CompleteNewb 3 1,904 Jan-20-2022, 04:50 AM
Last Post: CompleteNewb
  3D vector class with inheritance from 2D vector class buss0140 4 3,354 Dec-20-2020, 08:44 PM
Last Post: deanhystad
  Class inheritance oclmedyb 3 2,402 Dec-09-2020, 04:43 PM
Last Post: deanhystad
  Can we access instance variable of parent class in child class using inheritance akdube 3 14,211 Nov-13-2020, 03:43 AM
Last Post: SalsaBeanDip
  Behavior of Abstract Base Class dgrunwal 4 2,371 Oct-15-2020, 07:19 PM
Last Post: Gribouillis
  newbie question....importing a created class ridgerunnersjw 5 2,852 Oct-01-2020, 07:59 PM
Last Post: ridgerunnersjw

Forum Jump:

User Panel Messages

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