There are loads of answers on how to import modules from other folders.
The answer always seems to be along the lines of:
import sys
sys.path.insert(0,"c://UserName//MyFolder//MyBeautifulCode")
import myscript as ms
after which you can run ms.my_fun(x,y,z)
where my_fun() is defined in c://UserName//MyFolder//MyBeautifulCode//myscript.py
The code runs; however, what doesn't work is that, this way, I do not get the usual tooltip showing the arguments of my_fun(); if instead I copy myscript.py
in the very same folder as the script I am currently running, then, yes, I do get the tooltip.
What I mean is I don't see something like this:
I have tried with both PyCharm and Spyder and the behaviour, in this respect, is the same for both.
I suppose this happens because c://UserName//MyFolder//MyBeautifulCode//myscript.py
gets added to the path only when the script is run so, before it is run, the IDE doesn't find my_fun()
Is this correct?
If so, is the only solution to manually add c://UserName//MyFolder//MyBeautifulCode//myscript.py
to the path ?
By the way, I am talking about a couple of functions which I reuse in 3 separate programs I am running. It is nothing worth publishing on github or pip as a package or anything like that.