0

enter image description here

file: api_information.py

`import requests

def OpenProfile():`

file: Connect_selenium.py

from Api.api_automation import OpenProfile

However after running I get the error message:

** from Api.api_automation import OpenProfile ModuleNotFoundError: No module named 'Api'**

How should I fix it?

XmFocus
  • 21
  • 2

2 Answers2

0

If you're running Connect_selenium.py while in the Auto_Selenium directory it will not be able to find the Api directory to use as a module. To solve this, you can call Connect_selenium.py outside the directory with:

$ python3 Auto_Selenium/Connect_selenium.py

Also, add an __init__.py file to the Api directory.

vs07
  • 195
  • 8
0

enter image description here

If you run Conect_selenium.py in the path Autu_selenium will lead this error.

you can run program like this

python ./Auto_selenium/Conect_selenium.py
Xiaomin Wu
  • 400
  • 1
  • 5