Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to import module Python files?

enter image description here

file: api_information.py

`import requests

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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?

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading