Skip to content

Commit d235879

Browse files
committed
dynamic module import
1 parent f20c179 commit d235879

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crystal_toolkit/core/plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from __future__ import annotations
22

3+
from importlib import import_module
34
from importlib.metadata import version
45
from typing import TYPE_CHECKING
56

67
from flask_caching import Cache
78

8-
from crystal_toolkit.core.mpcomponent import MPComponent
99
from crystal_toolkit.settings import SETTINGS
1010

1111
if TYPE_CHECKING:
@@ -92,6 +92,7 @@ def crystal_toolkit_layout(self, layout) -> html.Div:
9292
layout = layout()
9393

9494
stores_to_add = []
95+
MPComponent = import_module("crystal_toolkit.core.mpcomponent.MPComponent")
9596
for basename in MPComponent._all_id_basenames:
9697
# can use "if basename in layout_str:" to restrict to components present in initial layout
9798
# this would cause bugs for components displayed dynamically

0 commit comments

Comments
 (0)