Python Forum
Relative import multiple levels ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Relative import multiple levels ?
#1
packages
- gradient
-- hsl_by_value.py
- objects
-- styles
--- box_style.py

How would I do? Like to do it with relative imports.
box_style.py
from ..gradient import hsl_by_value

I think I figure it out. So ... takes you to model name ?
from ...gradient import hsl_by_value
99 percent of computer problems exists between chair and keyboard.
Reply


Messages In This Thread
Relative import multiple levels ? - by Windspar - Feb-02-2018, 06:14 PM
RE: Relative import multiple levels ? - by Windspar - Feb-02-2018, 11:55 PM
RE: Relative import multiple levels ? - by snippsat - Feb-02-2018, 08:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to reference the relative directory when creating a photoimage kenwatts275 3 6,460 May-18-2021, 07:22 PM
Last Post: menator01
  pyautogui screenshotting region relative to image found on screen Bmart6969 3 6,450 Oct-05-2019, 06:20 PM
Last Post: Bmart6969
  how do i write a cross-platform relative file path? pseudo 2 2,983 Aug-23-2019, 05:07 PM
Last Post: ThomasL
  function wanted: resolve relative path Skaperen 4 3,379 Sep-06-2018, 01:52 AM
Last Post: Skaperen
  Python 3.6.5 pathlib weird behaviour when resolve a relative path on root (macOs) QbLearningPython 7 6,207 May-29-2018, 08:38 AM
Last Post: QbLearningPython
  Parse XML - how to handle deep levels/hierarchy dwill 8 9,522 Apr-17-2018, 04:17 PM
Last Post: dwill
  ValueError: Attempted relative import in non-package JoeB 1 11,979 Mar-08-2018, 11:01 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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