PythonCall just works when I close the REPL after importing OpenSSL_jll, but I cannot make it work in the same session

As of Python 3.13:

OpenSSL 1.1.1 is the minimum version and OpenSSL 3.0.9 is the recommended minimum version for the ssl and hashlib extension modules.

In Julia, and I think, per se, not contradictory (I see OpenSSL_jll build 3.0.15+1, and e.g. older OpenSSL_jll build 3.0.9+0 and OpenSSL_jll build 1.1.1+6):

OpenSSL_jll = “1.1, 3.0”

OpenSSL 3 is the current long-term support (LTS) version, anything older is no longer supported, so I doubt you want to use 1.1.1 even if you can.

I think you want to use Python 3.13, and I seem to remember something about there possibly being a conflict between OpenSSL [versions] in Python and Julia. Do you actually need OpenSSL_jll in Julia? Julia still uses MbedTLS, is that not good enough from the Julia side?

What is it exactly you need from the Python side, i.e. how do you load the package and confirm the version used?

Python 3.12.3 (main, Apr 21 2024, 17:40:47) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from OpenSSL import SSL
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'OpenSSL'

I’ve been having trouble installing Python packages like this one, or knowing for sure which one[s] are recommended:

Note: The Python Cryptographic Authority strongly suggests the use of pyca/cryptography where possible. If you are using pyOpenSSL for anything other than making a TLS connection you should move to cryptography and drop your pyOpenSSL dependency.

Julia 1.12 will use OpenSSL 3, so best get used to it: