Elektrine lite

← Feed

@geospacedman@mastodon.social

Post #1779605

2026-04-26 18:01 UTC

This works: >>> import PyQt5 >>> from PyQt5.QtCore import QUrl This fails: >>> import PyQt5 as PQ >>> from PQ.QtCore import QUrl Traceback (most recent call last): File "<python-input-4>", line 1, in <module> from PQ.QtCore import QUrl ModuleNotFoundError: No module named 'PQ' although PQ and PyQt5 seem to be the same: >>> PyQt5 <module 'PyQt5' from '[...]/python3.13/site-packages/PyQt5/__init__.py'> >>> PQ <module 'PyQt5' from '[...]/python3.13/site-packages/PyQt5/__init__.py'> huh?

Replies (1)

  • @sgillies@mastodon.social 2026-04-26 18:56

    @geospacedman Python's import statement loads modules from outside your local namespace (like your filesystem) into your namspace. There's no PQ module outside of your namespace.

    Open ##1817631