How to import a dependency app and use its components in the code

Hi,
I built an app that serves as dependency app for my main app. I can see the components of the dependencies app in the designer of the main app and can use them there by drag’n’drop. But how can I use the components in the code? The autocompleter does neither suggest me the dependency app nor one of the components in there?

According to the docs I should be able to do
import dependency

a = dependency.mycomponent()

Am I doing something wrong here or was there a change in recent days which could cause this, e.g. conversion to packages?

Here are the two apps:

MainApp + dependenc:
https://anvil.works/build#clone:VKNQC53DJGHC2662=NZV7TE6FUIQIZMT3YKJUCP3S

the problem is the import statement.

You want to call the class object whereas you are trying to call the Module object

Option 1

import dependency
a = dependency.my_component.my_comonent() # the first is the module the second is the class
self.content_panel.add_compnent(a)

Option 2

from dependency import my_component
a = my_component.my_comonent() # the first is the module the second is the class
self.content_panel.add_compnent(a)

Option 3

from dependency.my_component import my_component
a = my_comonent() 
self.content_panel.add_compnent(a)
2 Likes

Thanks, @stucork. That works.
But I’d like to flag this behavior as bug for the autocompleter. It is no problem, if the docs are not up to date and the autocompleter suggested the right thing. But if docs are not up to date and the autocompleter does not suggest anything than this costs a lot of time and I have to waste other peoples time for answering basic questions.

see this feature request…