Modules should only interact through nodes in the MRML scene, i.e., you select parameter node of one module as input of the other module. If you don’t want to require users to select nodes then you can use singleton parameter node (then you can look it up based on singleton tag).
Note that it is the best to minimize usage of file paths in the scene, as you don’t want your processing code littered with file reader/writer code. Instead, load data into nodes once and then only work with data nodes and node references. If you need to import data from proprietary file formats then you can implement a custom file reader in Python.
Thanks for sharing your solution. Referring to nodes by name is very fragile, because you can have many nodes in the scene by the same name. Instead, if you want to find a node in the scene by a string identifier then set that unique string in its singleton tag and retrieve it using slicer.mrmlScene.GetSingletonNode(). You can use something like “YourModuleName.SomeOtherString” as singleton tag to ensure that it is unique (each module names is unique).