diff --git a/example_python/generate_parameter_module_example/__init__.py b/example_python/generate_parameter_module_example/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/example_python/test/test_load_modules.py b/example_python/test/test_load_modules.py new file mode 100644 index 0000000..0d0bdf4 --- /dev/null +++ b/example_python/test/test_load_modules.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +import generate_parameter_module_example + +print(f'Imported module from: {generate_parameter_module_example.__file__}') + +import generate_parameter_module_example.admittance_parameters # noqa: E402 + +print('Imported generated parameter module') + +import generate_parameter_module_example.minimal_publisher # noqa: E402 + +print('Imported minimal publisher module') diff --git a/generate_parameter_library_py/generate_parameter_library_py/generate_python_module.py b/generate_parameter_library_py/generate_parameter_library_py/generate_python_module.py index 8ba867f..e0c899d 100755 --- a/generate_parameter_library_py/generate_parameter_library_py/generate_python_module.py +++ b/generate_parameter_library_py/generate_parameter_library_py/generate_python_module.py @@ -48,6 +48,10 @@ def run(output_file, yaml_file, validation_module=''): with open(output_file, 'w') as f: f.write(code) + # Put an __init__.py file if one does not yet exist. + init_file = os.path.join(os.path.dirname(output_file), '__init__.py') + open(init_file, 'a').close() + def parse_args(): parser = argparse.ArgumentParser()