我无法在带有子目录的python3中导入自己的模块

时间:2019-11-22 02:23:50

标签: package python-3.7

所以我想为我的python项目制作一个菜单,我制作了一个包装使其更加有条理 但是当我尝试导入名为src的程序包时,出现语法错误,说它不可调用

这是我的工作树:

.
├── Ideas
│   └── OSINT
│       └── Whitepages
├── LICENSE
├── src
│   ├── __init__.py
│   ├── menu
│   │   ├── __init__.py
│   │   ├── mainMenu.py
│   │   └── __pycache__
│   │       └── logo.cpython-36.pyc
│   └── __pycache__
│       └── __init__.cpython-36.pyc
└── watchmen.py

这是mainMenu.py:

from colorama import Fore, Style
import colorama
class Menu1:
    def __init__ (self):
        choice ='0'
        while choice =='0':
            print(Fore.WHITE + u"""
            Main Choice: Choose 1 of 4 choices
            1.begin
            2.Check for updates
            3.TrAiN)
            4.exit""")

            choice = input ("Please make a choice: ")

            if choice == "4":
                print()
                exit(Fore.WHITE + u"thanks for stalking by")
            elif choice == "3":
                print("Do Something 3")
            elif choice == "2":
                print("Do Something 2")
            elif choice == "1":
                print("Do Something 1")

            else:
                print("I don't understand your choice.")

错误消息:

Traceback (most recent call last):
  File "watchmen.py", line 37, in <module>
    src.menu.mainMenu()
TypeError: 'module' object is not callable

老实说,我不知道如何解决

0 个答案:

没有答案