简体   繁体   中英

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

一

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM