Skip to content
Discussion options

You must be logged in to vote

@gwsu2008 to give you an actual answer to your question.

There are two ways to get the app reference without circular import issues.

  1. Perform the from myapp import app inside the body of the background event function itself. This will delay the import, allowing the module to be fully initialized before you try to get a reference to it.
  2. Use from reflex.utils.prerequisites import get_app. Then get_app().app.event_namespace (note this will be None if the app is not running).

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@masenf
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by gwsu2008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants