WindmillWWindmill
Powered by
Oleksandr ManakovO
Windmill•3y ago•
6 replies
Oleksandr Manakov

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
from .temp import main as mmm
.
Both app and script are within the same user.
WindmillJoin
3,362Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Recent Announcements
henri-c

Weekly kenote to tell you about our latest updates https://discord.com/channels/930051556043276338/1278977038430240813 https://youtube.com/live/2dGd9TdT8xs?feature=share

henri-c · 4d ago

Pyra

### HTTP tracing (EE) Capture HTTP requests made by job scripts as observability spans Features: - View HTTP request traces (method, URL, status, timing) in the job details UI - Auto-instrumentation for Native TypeScript, MITM proxy for other languages - Integrates with external OpenTelemetry collectors changelog: https://www.windmill.dev/changelog/http-tracing docs: https://www.windmill.dev/docs/advanced/instance_settings#http-tracing Additionally jobs memory metrics are now fully OSS!

Pyra · 2w ago

henri-c

First keynote of the year here https://discord.com/channels/930051556043276338/1278977038430240813 🙂

henri-c · 4w ago

Similar Threads

Is it possible to change workspace name?
Bagas WastuBBagas Wastu / help
3y ago
Unable to add workspace scripts to flows
dfulton2009Ddfulton2009 / help
2y ago
Move scripts and flows to new workspace
BilgeBBilge / help
16mo ago
Utilities imported from scripts are not targeted by workspace deploy feature
aurelienbrabantAaurelienbrabant / help
3y ago