Is it possible to import functions from workspace scripts inside Background runnables?

One (probably stupid) question - is it possible to import functions from workspace scripts inside Background runnables? The same import works in other workspace script, but results an error when added to background runnable:
--- PYTHON CODE EXECUTION ---

Traceback (most recent call last):
File "<frozen runpy>", line 189, in _run_module_as_main
File "<frozen runpy>", line 159, in _get_module_details
File "<frozen importlib._bootstrap_external>", line 1074, in get_code
File "<frozen importlib._bootstrap_external>", line 1004, in source_to_code
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/tmp/windmill/wk-default-ffbdde9c7435-bx28a/018c586c-d693-39e8-0405-93e9507f19b1/wrapper.py", line 8
from u.username.111 import background_runnable_1_fullscreen as inner_script
^^^^
SyntaxError: invalid syntax
--- PYTHON CODE EXECUTION ---

Traceback (most recent call last):
File "<frozen runpy>", line 189, in _run_module_as_main
File "<frozen runpy>", line 159, in _get_module_details
File "<frozen importlib._bootstrap_external>", line 1074, in get_code
File "<frozen importlib._bootstrap_external>", line 1004, in source_to_code
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/tmp/windmill/wk-default-ffbdde9c7435-bx28a/018c586c-d693-39e8-0405-93e9507f19b1/wrapper.py", line 8
from u.username.111 import background_runnable_1_fullscreen as inner_script
^^^^
SyntaxError: invalid syntax
The import is as simple as: from .temp import main as mmm. Both app and script are within the same user.
4 Replies
rubenf
rubenf11mo ago
Try with absolute paths u.username.xxx
Oleksandr Manakov
Same error:
Traceback (most recent call last):
File "<frozen runpy>", line 189, in _run_module_as_main
File "<frozen runpy>", line 159, in _get_module_details
File "<frozen importlib._bootstrap_external>", line 1074, in get_code
File "<frozen importlib._bootstrap_external>", line 1004, in source_to_code
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/tmp/windmill/wk-default-787493b71853-RskJG/018c589e-37fe-d2a0-49c1-185cc1bc0db9/wrapper.py", line 8
from u.username.111 import background_runnable_1_fullscreen as inner_script
^^^^
SyntaxError: invalid syntax
Traceback (most recent call last):
File "<frozen runpy>", line 189, in _run_module_as_main
File "<frozen runpy>", line 159, in _get_module_details
File "<frozen importlib._bootstrap_external>", line 1074, in get_code
File "<frozen importlib._bootstrap_external>", line 1004, in source_to_code
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/tmp/windmill/wk-default-787493b71853-RskJG/018c589e-37fe-d2a0-49c1-185cc1bc0db9/wrapper.py", line 8
from u.username.111 import background_runnable_1_fullscreen as inner_script
^^^^
SyntaxError: invalid syntax
rubenf
rubenf11mo ago
I think one of the issue is the name 1111 Can you give your app another name that start with a letter
Oleksandr Manakov
You're right, it works when the app name starts from letter, thanks.