You got me curious, so i downloaded Electrum 4.0.9 AppImage and tried importing few library and here's the result
1. Importing built-in library shows no problem
>>> import sqlite3
>>> import datetime
2. Importing library required by Electrum (
https://github.com/spesmilo/electrum/blob/master/contrib/requirements/requirements.txt) shows no problem either
>>> import qrcode
>>> import bitstring
3. Importing library installed with pip command shows same error
>>> import jellyfish
Traceback (most recent call last):
import jellyfish
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/.mount_electrGXmrQe/usr/lib/python3.7/site-packages/electrum/gui/qt/console.py", line 262, in exec_command
exec(command, self.namespace, self.namespace)
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'jellyfish'
>>> import pandas
Traceback (most recent call last):
import pandas
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/.mount_electrGXmrQe/usr/lib/python3.7/site-packages/electrum/gui/qt/console.py", line 262, in exec_command
exec(command, self.namespace, self.namespace)
File "<string>", line 1, in <module>
However trying same thing with Electrum
installed with pip from source code shows no problem.
>>> import jellyfish
>>> import pandas
I think Electrum AppImage have it's own python and isolated from python or python library installed your OS.