导入破折号子应用程序包

问题描述

我创建了一个Dash应用程序,该应用程序本身运行良好(没有导入问题)。其他用户还创建了应用程序,我们现在希望将其合并到单个应用程序中,并使用链接每个应用程序的通用索引。我找不到加载我创建的程序包的解决方案。我想单独运行应用程序(用于调试目的),并通过常规索引运行(用于生产目的)。

这是我的应用程序的结构(类似于详细的here on the Dash documentation):

+ app.py --> creates the dash server
+ layout.py --> Defines my page layout
+ callbacks.py --> I imported packages here (import package as pk) that will fail when run via the general index
+ package --> the packages I created

合并项目后,我的结构看起来像这样(通过git submodule add):

+ app.py
+ index.py --> will call the layouts
+ initial app folder (git submodule from structure above)
  + __init__.py
  + the files above

启动服务器时,收到错误消息pk.something error,pk is not defined。我找不到使应用程序独立运行并在常规索引内运行的解决方案。我试图移动导入(在app.py或新的__init__.py中),但没有任何效果。 我的下一个尝试是将程序包移动到新的子文件夹中。有人知道这是否行得通吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)