![]() ![]() The _init_.py files are required to make Python treat theĭirectories as containing packages this is done to preventĭirectories with a common name, such as string, from unintentionally Sys.path looking for the package subdirectory. When importing the package, Python searches through the directories on For example, the module name A.B designates a Packages are a way of structuring Python’s module namespace by using Is there any way to resolve this error without changing the import statement in man1.py and without adding anything to sys.path?Įdit: python3 -m 1test from the original version of the question changed to python3 -m 1testįIRST, if you want to be able to access man1.py from man1test.py AND manModules.py from man1.py, you need to properly setup your files as packages and modules. My rationale behind the first import ( Soft) was to facilitate the aforementioned import statement in man1.py.Ĭontrary to my expectation, however, the import statement in man1.py gives rise to: ModuleNotFoundError: No module named 'Soft' I need the second import in man1test.py because man1test.py needs access to a function in man1.py. Man1test.py contains the following import statements: from. Man1.py contains the following import statement, which I do not want to change: from import * I'm using Python 3.7.1 on macOS Mojave Version 10.14.1 ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |