Python Forum
Python3: problem to import personals modules
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python3: problem to import personals modules
#1
Hi, all.

I have a problem to import personals modules.

My folder:
Quote:test.py
/modules/__init__.py
/modules/config.py
/modules/notification.py

I execute just the script 'test.py', by IDLE, or by run into terminal.
This script call the module 'config.py' without any problem... as:

from modules.config import Config
the 'config.py' need module 'notification.py', and i wrote the code as:
try:
    from modules.notification import Info
except ImportError:
    print(f'Cant import notification module onto Config')
    sys.exit(1)
Result the error:
Error:
Cant import notification module onto Config
I tested with:
from modules import notification
or, by using:
from __future__ import absolute_import

try:
    from . import notification
except ImportError:
or
from .modules import notification
Same problem!

Really, i dont understand!?
Reply


Messages In This Thread
Python3: problem to import personals modules - by PyForIO - Mar-03-2018, 01:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Different Ways to Import Modules RockBlok 2 541 Dec-11-2023, 04:29 PM
Last Post: deanhystad
  How can prepare the modules when compiling python3.11? luofeiyu 1 582 Sep-28-2023, 03:50 PM
Last Post: deanhystad
  problem in import module from other folder akbarza 5 1,440 Sep-01-2023, 07:48 AM
Last Post: Gribouillis
  [WORKED AROUND] Problem installing elitech-datareader, 'cannot import build_py_2to3' NeilUK 4 1,733 Jul-09-2023, 10:01 AM
Last Post: NeilUK
  Import Modules TheBunyip 4 1,254 Mar-10-2023, 04:47 PM
Last Post: buran
  a bunch of modules to import Skaperen 2 902 Nov-07-2022, 07:33 PM
Last Post: Gribouillis
  Import requests/beautifulsoup problem Jokadaro_ 3 2,064 Dec-05-2021, 01:22 PM
Last Post: Jokadaro_
  Did interpreter 'compile' all import modules(from thrid-party) jamesyuan 10 4,332 Oct-19-2020, 10:49 AM
Last Post: jamesyuan
  Problem with Flask Bcrypt import module marcello86 2 5,748 Aug-31-2020, 08:10 PM
Last Post: marcello86
  import yaml error for python3 maiya 4 13,166 Jul-15-2020, 06:07 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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