｜ ｜ —Alex.py
｜ ｜ —create_as.py
Please write your question in detail here.
I want to import another file.
I want to run create_as.py
In create_as.py, in order to use the class "Alex ()" in Alex.py
You need to import Alex.py.
■■ The following error message occurred while implementing the function.
No module named'models'Corresponding source code
// Part of the code (contents of create_as.py)
sys.path.append ('/ Users/username/Downloads/master/models /')
from models import Alex
// ↑ import partWhat I tried
Put "create_as.py" in master,
When I changed "from models import Alex" to "import models.Alex" and executed it, I got an error in this part, so I think it is a path problem.
Please describe here what you have tried for the problem.Supplementary information (FW/tool version, etc.)
Please provide more detailed information here.
Answer # 1
from Alex import Alex
So what about?
Answer # 2
Since the library search path has been set, import it normally.
import sys sys.path.append ('/ Users/username/Downloads/master/models /') import Alex
- python - i'm having trouble installing pynacl
- error in import xlrd of python file from cakephp
- html - i'm having trouble with the error couldn't find post with'id' = show
- python - i get an import error on an installed module
- ruby - [i'm having trouble with an error] cannot add foreign key constraint
- python - i got an import error even though i did pip install
- i'm having trouble installing python 390
- python 3x - i'm having trouble not knowing the regular expression that removes certain whitespace
- readcsv error in python
- python - an error occurs in the if statement program that compares the size of numbers
- python - i get an error when connecting to a voice channel with discordpy
- python - how to resolve attribute error
- [python] graphviz output format error
- indent error doesn't go away, python
- python - error when scraping with selenium and firefox
- python - sklearn, svm error
- python - categorical_crossentoropy error does not resolve
- python - import the original csv dataset
- python - i want to display an image with pysimplegui, but an error occurs
- python : Import from Parallel Folder
- python : Import from Parallel Folders
- python : ModuleNotFoundError: No module named 'matrix_np_api'
- imports in python
- Can't install Python packages
- python : What are import sys and sys.exit?
- python : How to identify the module in which the class has been declared directly