Skip to content

IDE confusion around functions calling each other? #2635

Closed
@zsiegel92

Description

@zsiegel92

If modal function fn_a calls modal function fn_b, and fn_b also calls fn_a, pyright gets confused!

Screenshot 2024-12-10 at 12 42 40 AM

The screenshot is from what I think is a MWE of this bug:

import modal


app = modal.App()


@app.function()
def fn_a(call_b: bool = True):
    if call_b:
        fn_b.remote()
    return


@app.function()
def fn_b():
    fn_a.remote(call_b=False)


@app.local_entrypoint()
def main():
    fn_a.remote()

The program above ia valid and runs fine, but my IDE is having a problem with something. The issue is cryptic - fn_a.remote appears to the IDE to be undefined - but only when both functions call each other! If the functions don't both call each other, either one can call either one with .remote with no issues.

Using VS Code, Python 3.12.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions