Revision history [back]
One way to approach this is to install your dependencies into Wing's Python using the pip executable located in bin/__os__/win32/runtime-python3.10 -- that's somewhat better than just dropping something into there and would take care of getting a compatible version and other dependency management. Of course this needs to be redone each time you install a new version of Wing from an installer (but not if you just use Check for Updates, since that doesn't replace the base install).
To reduce the chances of somehow breaking Wing, you could also place your dependencies somewhere and modify sys.path to import, ideally removing your added directory after the import(s) are done:
import sys dirname = '/path/to/dependencies' sys.path.append(dirname) import testmod sys.path.remove(dirname)
Or to avoid modifying sys.path at all, use importlib. This is the cleanest approach in terms of not affecting the rest of Wing's functionality, but also the most complex one to actually implement:
import os from importlib.util import spec_from_file_location, module_from_spec dirname = '/path/to/dependencies' spec = spec_from_file_location('testmod', os.path.join(dirname, 'testmod.py')) testmod = module_from_spec(spec) spec.loader.exec_module(testmod)
In practice, I think any of these is fine.