Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ModuleNotFoundError
#6
(Aug-23-2022, 01:47 AM)rob101 Wrote: Well, that should be from model import util and from model.hr import hr I think.
Yes that should be right.

Kjaglewicz is do it like this easier to see the structure.
secure-erp\
  controller\
    |-- hr_controller.py
    |-- main_controller.py
  model\
    |-- util.py
    hr\
      |-- hr.py

A quick test.
util.py
def util_func():
    print('util func')
hr.py
def hr_func():
    print('hr stuff')
(secure-erp) G:\div_code\secure-erp
λ ptpython
>>> from model import util
>>>
>>> util.util_func()
util func
>>>
>>> from model.hr import hr
>>>
>>> hr.hr_func()
hr stuff
>>>
I usually make virtual envirmont then there is no OS Path problems.
Also install ptpython then get autocomplete when try out imports,then can see earlier what it find or not.
[Image: IfMDK4.png]
rob101 likes this post
Reply


Messages In This Thread
ModuleNotFoundError - by Kjaglewicz - Aug-22-2022, 10:24 PM
RE: ModuleNotFoundError - by rob101 - Aug-23-2022, 01:20 AM
RE: ModuleNotFoundError - by Kjaglewicz - Aug-23-2022, 01:23 AM
RE: ModuleNotFoundError - by rob101 - Aug-23-2022, 01:36 AM
RE: ModuleNotFoundError - by rob101 - Aug-23-2022, 01:47 AM
RE: ModuleNotFoundError - by snippsat - Aug-23-2022, 11:39 AM

Forum Jump:

User Panel Messages

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