DragneelFPS
DragneelFPS

Reputation: 473

How to use user packages in Visual Studio 2017 in a python application

One

I have this python application structure in Visual Studio 2017. I created a tests folder using the Solution explorer and there's a test.py file in it. I want to use the test module which is stored in tests directory. But when I try to use import tests.test it says test not defined. I have just started learning python. I looked up to this but I dont understand why isnt it working. Am I doing something wrong? I looked it up here

Upvotes: 0

Views: 571

Answers (1)

Adrijaned
Adrijaned

Reputation: 450

You are trying to import from from package. Each package must have an __init__.py file. You just have to add a blank file __init__.py to your tests folder and then it should be fine.

Upvotes: 4

Related Questions