How can I import python module properly instead of namespace package

조회 수: 7 (최근 30일)
Przemyslaw Niedziela
Przemyslaw Niedziela 2022년 9월 12일
답변: Al Danial 2022년 9월 16일
I'm trying to import python module asammdf with:
py.importlib.import_module('asammdf');
it gives me the following:
'<module 'asammdf' (namespace)>'
but the:
'<module 'asammdf' from 'C:\\Program Files\\Python38\\lib\\site-packages\\asammdf\\__init__.py'>'
was expected.
Once I try using the library with:
MDF = py.asammdf.MDF();
I will recieve:
Unable to resolve the name py.asammdf.MDF
Any thouights how can i solve it?
* I already reinstalled python and checked the same lib on python cosole - it works there.

답변 (1개)

Al Danial
Al Danial 2022년 9월 16일
Try assigning the import to a variable:
asammdf = py.importlib.import_module('asammdf');
then
MDF = asammdf.MDF();

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by