从同一文件夹导入Python软件包时,如何修复函数的重叠?
我有一个称为libs
的文件夹,它有两个文件(database.py
和keymanagementservice.py
)在Libs文件夹外部文件。为此,我在Libs文件夹中做了一个__ INIT
from Libs.database import *
from Libs.keyManagmentService import *
。
import Libs as db
import Libs as kms
__ 数据库文件与KeyManagementservice文件的函数重叠,因此,如果我尝试使用db
例如,kms
的函数也将显示。如何使这些图书馆独立,因为缺乏更好的措辞?谢谢!
I have a folder called Libs
that has two files (database.py
and keyManagementService.py
) I'd like to import as libraries to another file outside of the Libs folder. To do that, I made an __init__.py
in the Libs folder which looks like this:
from Libs.database import *
from Libs.keyManagmentService import *
The way I imported the libraries to a file outside of Libs was like this:
import Libs as db
import Libs as kms
However, the issue is the functions from the database file overlaps with the functions from the KeyManagementService file, so if I try using db
for example, the functions from kms
would also show up. How can I make these libraries standalone for a lack of better wording? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您从
__ Init __.py
中清除内容(但请留空文件),您应该能够If you clear the content from
__init__.py
(but leave the empty file), you should be able to