I don't think the cause is specific version of Python or .NET because, if you were able to do the appropriate installs like below, then all the requirements should have been met.
pip install --upgrade azure-quantum
pip install qsharp
dotnet tool install -g Microsoft.Quantum.IQSharp
dotnet iqsharp install
When you run
import qsharp, the IQ# kernel will get started (Source) and then it will will look for .qs files in the current working directory ( Source 1, Source 2).
Then it exposes the Q# code/namespaces from the .qs files as Python modules/callables.
Check to see if no errors surfaced from calling
Note: That's why, although a good guess, that the comment by ryanhill1 does not apply here. The IQ# Kernel won't parse any .py files including
__init__.py. That would normally apply for pure Python-based toolkits (like Qiskit), but not for Q#, which relies on some .NET components.
Normally, we would assume that the current working directory would be the same directory as the .py or .ipynb file, but it's not always the case.
In this case, make sure that when you call your .py file (with
python myscript.py or when you start a
jupyter notebook that you are in the path that contains the .qs file that you want to import.
For that you would normally just have to
cd in your terminal/CLI to that path first, before running your script/notebook.
Alternatively, you can try to add this to the top of your .py file, which will change the working directory to the script's location before the
import qsharp. Note: it may not work from inside a notebook.
Hope it helps.
If not, let me know and I can look for other potential causes.