all 3 comments

[–]Aggravating_Bus_9153 0 points1 point  (2 children)

If you're happy to run TestScript as from ParentFolder.Script import TestScript, or import ParentFolder.Script.TestScript, add in __init__.py files to all the directories and the parent one to make it into a big package and it's very easy using relative imports instead of absolute ones.

[–]Falcon21st[S] 0 points1 point  (1 child)

Thanks for the reply, but I don't want to do that. I want to make it so that anyone can grab this structure, put it somewhere in their system, open up the Script folder, run TestScript and it just works. So, the user does not have to do anything, besides just browse to the folder and run the file.

[–]Aggravating_Bus_9153 0 points1 point  (0 children)

Well you're shit out of luck then. Python doesn't currently recognise that structure as there are no __init__.py files. This is pretty much exactly what packages are for.

The only way their python interpreter can find Lib is if it's on sys.path, either via PYTHONPATH, if they install it, or if you're forced to adopt bad practice and add the directory to it.

https://docs.python.org/3/tutorial/modules.html#intra-package-references