We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.
構造全般

構造全般

スクリプト機能に自作モジュールをインポートする方法

    • FAQFAQ
      Participant

      添付したスクリプトのExternalModuleTest.pyを適切なディレクトリに格納し、 Mechanicalのスクリプト機能からImportSample.pyを実行してください。 ExternalModuleTest.pyにて設定された「This is External Module!」というメッセージが表示されます。 スクリプトのポイントは以下の点です。 以下のようにして、Python実行時のパスに、ExternalModuleTest.pyを保存したディレクトリを指定します。 import sys my_path = “D:\Workspace\Supports” sys.path.append(my_path) 上記コマンドを実行するとimport ExternalModuleTestを実行する際、my_pathに指定したディレクトリが参照されます。