Replies: 1 comment
-
Hey @KSH94, I'm here to help you out! I'm a bot that can assist with bugs, questions, and even guide you on how to become a contributor. Let's squash those bugs together! 🤖 To resolve the circular import issue when trying to load a custom component in Langflow, you can use the
Here is the relevant part of the code that handles this: def _import_input_class():
from langflow.template.field.base import Input
return Input
def _import_output_class():
from langflow.template.field.base import Output
return Output
def __getattr__(name: str) -> Any:
# This is to avoid circular imports
if name == "Input":
return _import_input_class()
elif name == "Output":
return _import_output_class()
# The other names should work as if they were imported from constants
from . import constants
return getattr(constants, name) By using this approach, you can avoid circular import issues while still being able to access the necessary components dynamically [1]. Make sure to update your custom component script accordingly and try loading it again. This should resolve the circular import issue and allow your custom component to appear in the Langflow UI. |
Beta Was this translation helpful? Give feedback.
-
I am unable to load the custom component.
I was following the guide in https://docs.langflow.org/tutorials/custom_components .
Below is what I did:
However, I could not find the custom component menu in the sidebar of the displayed langflow UI.
While looking for the cause, I found that an error occurred in the import statement below.
The error details are as follows.
I am wondering if I made a mistake loading the custom component or if it is currently not possible to load it due to the above issue (circular import).
Beta Was this translation helpful? Give feedback.
All reactions