05-12-2023 07:22 AM
Hi everyone,
I'm looking for a way to enable the display of function docstrings and autocompletion when importing a custom Python library. Currently, all our functions, classes, and other components are placed in a single file, which makes the docstrings visible but can get quite messy over time.
I've tried creating a package and installing it into the site-packages folder, but that hasn't been successful. Meanwhile, external packages like "os" work perfectly fine with docstrings and autocompletion. Any suggestions on how to achieve this for custom libraries would be greatly appreciated.
Solved! Go to Solution.
05-15-2023 09:20 AM
Hi dm999,
you just need to copy the Python scripts directly to the Python/Lib directory, then autocompletion and docstrings should work.
You may have to restart DIAdem if modules with the same name have already been used.
05-16-2023 02:40 AM
Hi DIAdemo,
unfortuneatly this doesnt seem to work in my case. I copied the library in the directory you mentioned. I tried as package and just as file. I can access all the function, classes but still no docstrings, autocomplete etc.. i am working on the latest version (
DIAdem 2023 Q2).
05-22-2023 05:33 AM
Hi dm999,
I see the .py files are not directly in the lib directory but in a subdirectory.
Then the main file must be named "__init__.py".
05-22-2023 08:54 AM
Hi,
in the folder it is structured like this:
with this __init__.py
i also tried to import a file directly from the Lib directory
this is how i import the two libraries
05-22-2023 10:31 AM
Hi,
got it to work now. Copied everything in the __init__.py. Good enough for now, but i still think this shouldnt be the final solution.
thank you very much DIAdemo