#6894·flet

bug: Runtime packaged application fails with misleading module 'flet' has no attribute 'ElevatedButton' error

Author: nelson-pythonCreated Sep 27, 2026Updated Sep 28, 2026
Labelsbug

Duplicate Check

Describe the bug

ENVIRONMENT

Windows 11 Python 3.13.14

Flet 0.86.3 (reproduced) Flet 1.0.1 (reproduced)

Flutter 3.44.8

BUILD COMMAND

flet build windows -v

SUMMARY

A Flet application that uses:

ft.ElevatedButton(...)

...builds successfully, but the generated Windows executable fails at runtime with:

AttributeError: module 'flet' has no attribute 'ElevatedButton'

However, ElevatedButton clearly exists and can be imported and instantiated successfully from Python.

Replacing:

ft.ElevatedButton(...)

...with:

ft.Button(...)

...allows the executable to launch normally.

RUNTIME ERROR

The application encountered an error:
module 'flet' has no attribute 'ElevatedButton'

Traceback (most recent call last):
  File "C:\flutter\extension26\examples\test_extension_26_example\build\site-packages\flet\app.py", line 368, in on_session_created
  File "C:\Users\Nelso\AppData\Local\Temp\serious_python_tempXXXX\main.py", line 221, in main
  File "C:\Users\Nelso\AppData\Local\Temp\serious_python_tempXXXX\main.py", line 108, in build_canvas_toolbar
  File "C:\flutter\extension26\examples\test_extension_26_example\build\site-packages\flet\__init__.py", line 1818, in __getattr__
AttributeError: module 'flet' has no attribute 'ElevatedButton'

VERIFICATION PERFORMED

Verified that ElevatedButton exists:

import flet as ft

print(ft.ElevatedButton)

...results in:

<class 'flet.controls.material.elevated_button.ElevatedButton'>

Verified that it can be instantiated:

import flet as ft

b = ft.ElevatedButton("Test")

print(b)

...results in:

DeprecationWarning: ElevatedButton is deprecated since version 0.80.0 and will be removed in version 1.0. Use Button instead. Button(...)

This demonstrates:

  1. ElevatedButton exists.
  2. ElevatedButton imports successfully.
  3. ElevatedButton can be instantiated successfully.
  4. The symbol is not actually missing.

WORKAROUND

Replace:

ft.ElevatedButton(...)

...with:

ft.Button(...)

The executable then launches normally.

Code sample

Code
import flet as ft

def main(page: ft.Page):
    page.add(
        ft.ElevatedButton(
            "Test"
        )
    )

ft.app(main)

To reproduce

flet build windows

Expected behavior

EXPECTED BEHAVIOR

Either:

ft.ElevatedButton(...)

...should continue working while the API exists, or the runtime should produce an explicit deprecation/removal message such as:

ElevatedButton is deprecated. Use ft.Button instead.

ACTUAL BEHAVIOR

A runtime error is generated:

module 'flet' has no attribute 'ElevatedButton'

...even though:

print(ft.ElevatedButton)

...and:

ft.ElevatedButton("Test")

...succeed in Python.

Screenshots / Videos

CapturesImage

Operating System

Windows

Operating system details

Windows 11 Professional

Flet version

1.0.1 and 0.86.3

Regression

No, it isn't

Suggestions

WHY THIS IS PROBLEMATIC

The error message suggests:

  1. Broken installation
  2. Incorrect Flet version
  3. Missing package
  4. Packaging failure

As a result, significant debugging effort was spent investigating:

  1. Flutter assets
  2. pubspec.yaml changes
  3. build artifacts
  4. Flet packaging
  5. version mismatches

...when the actual workaround was simply changing:

ft.ElevatedButton

...to:

ft.Button

ADDITIONAL NOTES

  1. Reproduced on Flet 0.86.3.

  2. Reproduced again after upgrading to: Flet 1.0.1 flet-cli 1.0.1 flet-desktop 1.0.1 flet-web 1.0.1

  3. Build completes successfully.

  4. Failure occurs only after launching the generated executable.

Logs

Logs
the

Traceback (most recent call last):
  File "C:\flutter\extension26\examples\test_extension_26_example\build\site-packages\flet\app.py", line 368, in on_session_created
  File "C:\Users\Nelso\AppData\Local\Temp\serious_python_tempa254e7b5\main.py", line 221, in main
  File "C:\Users\Nelso\AppData\Local\Temp\serious_python_tempa254e7b5\main.py", line 108, in build_canvas_toolbar
  File "C:\flutter\extension26\examples\test_extension_26_example\build\site-packages\flet\__init__.py", line 1818, in __getattr__
AttributeError: module 'flet' has no attribute 'ElevatedButton'

Additional details

While investigating this issue, a significant amount of debugging time was spent distinguishing between:

  1. Runtime packaging issues
  2. Flutter extension issues
  3. Stale generated artifacts
  4. Actual application code defects

For developers working with custom Flet extensions, it is often unclear when a Flutter dependency change requires a full rebuild of generated artifacts.

SUGGESTED IMPROVEMENTS

- Better Detection of Stale Extension Artifacts

When files such as:

pubspec.yaml

...or Flutter extension source files change, it would be helpful if Flet could:

  1. Detect the change automatically.
  2. Warn that cached/generated artifacts may be stale.
  3. Recommend the appropriate cleanup steps.

Example:

Detected changes to Flutter extension dependencies.

A clean rebuild is recommended:

    flutter clean
    flutter pub get
    flet clean

- Add an Official "Deep Clean" Command

Historically, troubleshooting extension issues often involves manually removing build directories.

For example:

build/
.dart_tool/
.flutter-plugins-dependencies

A command such as:

flet clean --deep

...could remove all generated artifacts associated with:

  1. Flutter
  2. Python packaging
  3. Extension packaging

This would eliminate guesswork and make troubleshooting much easier.

- Improved Error Reporting for Packaged Applications

In this case, the runtime error ultimately pointed to:

module 'flet' has no attribute 'ElevatedButton'

However, the actual resolution was replacing a deprecated control with:

ft.Button(...)

The error message caused debugging effort to focus on:

  1. Flutter assets
  2. pubspec.yaml
  3. Build cache corruption
  4. Version mismatches

...rather than the deprecated control itself.

More explicit diagnostics would substantially reduce troubleshooting time.

WHY THIS MATTERS

Flet's extension architecture combines:

  1. Python
  2. Flutter
  3. Dependency packaging
  4. Runtime code generation

When something goes wrong, developers can spend considerable time determining which layer is responsible.

Better cache management, rebuild guidance, and error diagnostics would greatly improve the extension-development experience.