Answer the question
In order to leave comments, you need to log in
Python: How to run a module as a script in a package?
There is an architecture:
/
- readme.md
- name_of_project
-- bin
-- packages
--- foobar
----- __init__.py
----- FoobarModule.py
--- logs
----- __init__.py
-- --- LogsModule.py
Contents of
FoobarModule.py
import packages.logs.LogsModule
#some code
if __name__ == '__main__':
#do some work with this module
python root/name_of_project/packages/foobar/FoobarModule
but the error is thrown that it cannot find the LogsModule module. python -m packages.foobar.FoobarModule
Answer the question
In order to leave comments, you need to log in
from packages.logs import LogsModule?
I would say that it would be better if you wrote unittests instead of manually running each file,
this is both more useful and easier
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question