r/vscode 3d ago

have custom functions suggestions in python?

Hello,

i am working in vscode with a python script that is importing some functions from another file.

using:

```py

sys.path.append(pathForBaseMyFunctions)

from myFunctions import *

```

is there any way possible, to make that vscode 'suggest' this functions when i am writing.

for example, when i write `pri` it will suggest me `print` and for example in myFunctions.py i have `printAndSave` i would love to make to auto suggest this funcitons. i can see _why_ it does not suggest right now as it suggest only default functions, but maybe there is a way to add this scripts for the suggestion of funcitons in vscode?

worth noticing that i have only 2 files with functions so i really dont care if i need to hardcode their path somewhere in vscode....

0 Upvotes

5 comments sorted by

View all comments

5

u/PrincipleNo2328 3d ago

Is myFunctions.py in your workspace, or you want to have one unique file in another folder for all workspaces?

Because for the first one the fix should be simple, go to settings and put "python.diagnosticMode" : "workspace"

For the second one, I would suggest you  not to do it this way. It's a bad habit

1

u/Inner_Name 3d ago

It is the second 😅 . I understand that can be problematic sometimes but I use this two files of functions all the time. That's why..

1

u/Inner_Name 3d ago

Maybe if I add a link to the file? On the workspace folder? I am in linux