Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 99318

Visual Studio Code Python load own modules

$
0
0

I am pretty new using python in Visual Studio Code. I am using Python3. I'm trying to import a own class from a file, but I can't find the right syntax in Visual Studio Code.

My structure:

└── CodeAna
    │ __init__.py
    ├── GetDB
    │   ├── GetData.py
    │   ├── __init__.py   
    │  
    ├── HelerTools
    │   ├── Helper.py
    │   ├── __init__.py   
    │  
    └── Analysis
        ├── GetAnalysis.py
    │   ├── __init__.py                    

In GetAnalysis.py, I need to import a class called GetDataDB, which is located in GetData.py. My solution would be:

import CodeAna.GetDB.GetData as dl
Data = dl.GetDataDB()

But then I get this error:

Traceback (most recent call last):
  File "/Users/Test/VSC_Codes/CodeAna/TestAnalysis/GetAnalysis.py", line 1, in <module>
    import GetDB.GetData.GetDataDB as dl
ModuleNotFoundError: No module named 'GetDB'

Doing that within Spyder it works. I am not suore what I am doing wrong here???


Viewing all articles
Browse latest Browse all 99318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>