I thought that imports in the server console worked the same way as imports in a server module. However, I noticed a difference when I followed the steps below.
Does anyone understand why there is this inconsistency?
Create App1
Add a server module
Add a function called hello
Create App2
Add App1 as dependency
Create a server console
The following works as expected - good!
import App1
App1.ServerModule1.hello()
Add a server module
Adding the same code to the server module says AttributeError: module 'App1' has no attribute 'ServerModule1 - bad!
Sorry for the long delay in replying. I’m just getting started researching Anvil’s Server Console tab/pane, and saw that this had no reply.
My best guess: after step 6, the console is still running the code as it was as of the point in time when the app began running.
This matches what happens when I run a Python app in Windows. The running App isn’t affected by changes to the App’s source code until the app is restarted. That’s when the new code gets recompiled (or fails to compile!), and loaded into memory for execution.