labs4capella / python4capella

Python for Capella
Eclipse Public License 2.0
53 stars 10 forks source link

Property Value type stops the API from working #232

Open kortvelyin opened 4 weeks ago

kortvelyin commented 4 weeks ago

When in the "workspace://Python4Capella/sample_scripts/Export_Property_Values_associated_to_elements_to_xlsx.py" script I write "Class" as the type, (I wanted to get the CBD diagram parts,) Capella starts to give the "ModuleNotFoundError: No module named 'simplified_api'" error. From then on, whatever I run, however I rename or re-import the simplified_api folder, same error. I tried to restart Capella, refresh, nothing. Only solution I found is to delete the Python4capella project from capella and then re-import it.

ylussaud commented 3 weeks ago

PyDev automatically import some used modules the Python way. Check that you use:

# include needed for the Capella modeller API
include('workspace://Python4Capella/simplified_api/capella.py')
if False:
    from simplified_api.capella import *

and not just:

from simplified_api.capella import *

or

import simplified_api.capella

EASY need to copy everything imported using include() in the main module to work. At least as far as I understood.