部分初始化的模块(很可能是由于循环导入)

发布于 2025-01-11 08:58:43 字数 1043 浏览 0 评论 0原文

我读过很多很多关于这个主题的帖子,但每个人都说“重命名文件”。 遗憾的是,我已经完成了多次+重命名类+重命名实例,但没有运气。

那是我的文件夹结构

错误: 输入图片这里的描述

当我从文件“measureSys.py”中取出“import start”时,程序会运行直到它必须使用measureSys.py(缺少Main,因为当然我的主类丢失了)

Top Section (measureSys.py)

import start
from modules import loggingSys
from modules import alarmSys

# Creation of instance(object) of class LoggingSystem to log measurement activity
logging = loggingSys.LoggingSystem()
# Creating instance(object) of class AlarmSystem to be able to send alarms to user/email
alarm = alarmSys.AlarmSystem()

starting = start.Main()

class MeasureSystem:

并且该类“start.py”被命名为“Main”

Top Section (start.py)
from modules import measureSys
    
measureSystem = measureSys.MeasureSystem()

如果我监督某些事情,请联系我:(!

I have read many many many posts about this topic but everyone says "rename file".
Ive done it multiple times now + renaming classes + renaming instances with no luck, sadly.

Thats My Folder Structure

Error:
enter image description here

When I take out "import start" from file "measureSys.py" the program runs until it has to use measureSys.py (missing Main because of course my main class is missing)

Top Section (measureSys.py)

import start
from modules import loggingSys
from modules import alarmSys

# Creation of instance(object) of class LoggingSystem to log measurement activity
logging = loggingSys.LoggingSystem()
# Creating instance(object) of class AlarmSystem to be able to send alarms to user/email
alarm = alarmSys.AlarmSystem()

starting = start.Main()

class MeasureSystem:

And the class in "start.py" is named "Main"

Top Section (start.py)
from modules import measureSys
    
measureSystem = measureSys.MeasureSystem()

If I oversee something, please hit me up :( !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文